mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
bug #903: clean swap API regarding extra enable_if parameters, and add failtests for swap
This commit is contained in:
@@ -38,6 +38,9 @@ ei_add_failtest("ref_3")
|
||||
ei_add_failtest("ref_4")
|
||||
ei_add_failtest("ref_5")
|
||||
|
||||
ei_add_failtest("swap_1")
|
||||
ei_add_failtest("swap_2")
|
||||
|
||||
if (EIGEN_FAILTEST_FAILURE_COUNT)
|
||||
message(FATAL_ERROR
|
||||
"${EIGEN_FAILTEST_FAILURE_COUNT} out of ${EIGEN_FAILTEST_COUNT} failtests FAILED. "
|
||||
|
||||
14
failtest/swap_1.cpp
Normal file
14
failtest/swap_1.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "../Eigen/Core"
|
||||
|
||||
using namespace Eigen;
|
||||
|
||||
int main()
|
||||
{
|
||||
VectorXf a(10), b(10);
|
||||
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
|
||||
const DenseBase<VectorXf> &ac(a);
|
||||
#else
|
||||
DenseBase<VectorXf> &ac(a);
|
||||
#endif
|
||||
b.swap(ac);
|
||||
}
|
||||
14
failtest/swap_2.cpp
Normal file
14
failtest/swap_2.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "../Eigen/Core"
|
||||
|
||||
using namespace Eigen;
|
||||
|
||||
int main()
|
||||
{
|
||||
VectorXf a(10), b(10);
|
||||
VectorXf const &ac(a);
|
||||
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
|
||||
b.swap(ac);
|
||||
#else
|
||||
b.swap(ac.const_cast_derived());
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user