From 7319f88a0540f37f55d073572f713f96d06fe279 Mon Sep 17 00:00:00 2001 From: Fabian Knorr Date: Sat, 17 Feb 2024 16:40:39 +0100 Subject: [PATCH] Fix: Call to erase_if is ambiguous with C++20 --- util/device_set.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/util/device_set.cpp b/util/device_set.cpp index 3c6fcf23c..f6806d15e 100644 --- a/util/device_set.cpp +++ b/util/device_set.cpp @@ -48,7 +48,9 @@ void device_set::intersect(const device_set& other) { const auto& device = *it; return other.m_devices.find(device) == other.m_devices.end(); }; - erase_if(m_devices, condition); + // must explicitly specify namespace `util` to avoid ambiguity with + // std::erase_if when compiling for C++20 + util::erase_if(m_devices, condition); } void device_set::removeDevsWith(sycl::aspect aspect) { @@ -56,7 +58,7 @@ void device_set::removeDevsWith(sycl::aspect aspect) { const auto& device = *it; return device.has(aspect); }; - erase_if(m_devices, condition); + util::erase_if(m_devices, condition); } void device_set::removeDevsWith(std::initializer_list aspects) { @@ -70,7 +72,7 @@ void device_set::removeDevsWithout(sycl::aspect aspect) { const auto& device = *it; return !device.has(aspect); }; - erase_if(m_devices, condition); + util::erase_if(m_devices, condition); } void device_set::removeDevsWithout(const kernel_restrictions& restriction) { @@ -78,7 +80,7 @@ void device_set::removeDevsWithout(const kernel_restrictions& restriction) { const auto& device = *it; return !restriction.is_compatible(device); }; - erase_if(m_devices, condition); + util::erase_if(m_devices, condition); } device_set device_set::filtered(const device_set& other, sycl::aspect aspect) {