diff --git a/include/boost/core/swap.hpp b/include/boost/core/swap.hpp index baa1be9..eff6b97 100644 --- a/include/boost/core/swap.hpp +++ b/include/boost/core/swap.hpp @@ -21,13 +21,19 @@ // avoid ambiguity when swapping objects of a Boost type that does // not have its own boost::swap overload. +#include +#include #include //for std::swap (C++11) #include //for std::swap (C++98) #include //for std::size_t -#include namespace boost_swap_impl { + // we can't use type_traits here + + template struct is_const { enum _vt { value = 0 }; }; + template struct is_const { enum _vt { value = 1 }; }; + template BOOST_GPU_ENABLED void swap_impl(T& left, T& right) @@ -51,7 +57,8 @@ namespace boost { template BOOST_GPU_ENABLED - void swap(T1& left, T2& right) + typename enable_if_c< !boost_swap_impl::is_const::value && !boost_swap_impl::is_const::value >::type + swap(T1& left, T2& right) { ::boost_swap_impl::swap_impl(left, right); }