mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-07 18:27:40 +08:00
Move internal::swap to numext to fix ambiguous call with std::swap
This commit is contained in:
parent
8edc964734
commit
8fe609311d
@ -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
|
||||
|
@ -606,12 +606,12 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
|
||||
|
||||
// Sort in increasing order.
|
||||
if (roots(0) >= roots(1))
|
||||
internal::swap(roots(0),roots(1));
|
||||
numext::swap(roots(0),roots(1));
|
||||
if (roots(1) >= roots(2))
|
||||
{
|
||||
internal::swap(roots(1),roots(2));
|
||||
numext::swap(roots(1),roots(2));
|
||||
if (roots(0) >= roots(1))
|
||||
internal::swap(roots(0),roots(1));
|
||||
numext::swap(roots(0),roots(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user