mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add free-function swap.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
820e8a45fb
commit
b396a6fbb2
@@ -642,6 +642,18 @@ class DenseBase
|
||||
EIGEN_DEVICE_FUNC explicit DenseBase(const DenseBase<OtherDerived>&);
|
||||
};
|
||||
|
||||
/** Free-function swap.
|
||||
*/
|
||||
template <typename DerivedA, typename DerivedB>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||
// Use forwarding references to capture all combinations of cv-qualified l+r-value cases.
|
||||
std::enable_if_t<std::is_base_of<DenseBase<std::decay_t<DerivedA>>, std::decay_t<DerivedA>>::value &&
|
||||
std::is_base_of<DenseBase<std::decay_t<DerivedB>>, std::decay_t<DerivedB>>::value,
|
||||
void>
|
||||
swap(DerivedA&& a, DerivedB&& b) {
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif // EIGEN_DENSEBASE_H
|
||||
|
||||
Reference in New Issue
Block a user