mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-26 14:54:30 +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; };
|
{ typedef T type; };
|
||||||
|
|
||||||
#if defined(__CUDA_ARCH__)
|
#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 {
|
namespace device {
|
||||||
|
|
||||||
template<typename T> struct numeric_limits
|
template<typename T> struct numeric_limits
|
||||||
{
|
{
|
||||||
EIGEN_DEVICE_FUNC
|
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
|
#endif
|
||||||
|
|
||||||
/** \internal
|
/** \internal
|
||||||
@ -262,6 +260,16 @@ template<typename T, int S> struct is_diagonal<DiagonalMatrix<T,S> >
|
|||||||
|
|
||||||
} // end namespace internal
|
} // 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
|
} // end namespace Eigen
|
||||||
|
|
||||||
#endif // EIGEN_META_H
|
#endif // EIGEN_META_H
|
||||||
|
@ -606,12 +606,12 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
|
|||||||
|
|
||||||
// Sort in increasing order.
|
// Sort in increasing order.
|
||||||
if (roots(0) >= roots(1))
|
if (roots(0) >= roots(1))
|
||||||
internal::swap(roots(0),roots(1));
|
numext::swap(roots(0),roots(1));
|
||||||
if (roots(1) >= roots(2))
|
if (roots(1) >= roots(2))
|
||||||
{
|
{
|
||||||
internal::swap(roots(1),roots(2));
|
numext::swap(roots(1),roots(2));
|
||||||
if (roots(0) >= roots(1))
|
if (roots(0) >= roots(1))
|
||||||
internal::swap(roots(0),roots(1));
|
numext::swap(roots(0),roots(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user