Move internal::swap to numext to fix ambiguous call with std::swap

This commit is contained in:
Gael Guennebaud
2013-11-07 09:01:26 +01:00
parent 8edc964734
commit 8fe609311d
2 changed files with 14 additions and 6 deletions

View File

@@ -89,9 +89,9 @@ template<typename T> struct enable_if<true,T>
{ typedef T type; };
#if defined(__CUDA_ARCH__)
template<typename T> EIGEN_DEVICE_FUNC void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; }
namespace device {
template<typename T> struct numeric_limits
{
EIGEN_DEVICE_FUNC
@@ -110,8 +110,6 @@ template<> struct numeric_limits<double>
}
#else
template<typename T> EIGEN_STRONG_INLINE void swap(T &a, T &b) { std::swap(a,b); }
#endif
/** \internal
@@ -262,6 +260,16 @@ template<typename T, int S> struct is_diagonal<DiagonalMatrix<T,S> >
} // end namespace internal
namespace numext {
#if defined(__CUDA_ARCH__)
template<typename T> EIGEN_DEVICE_FUNC void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; }
#else
template<typename T> EIGEN_STRONG_INLINE void swap(T &a, T &b) { std::swap(a,b); }
#endif
} // end namespace numext
} // end namespace Eigen
#endif // EIGEN_META_H