mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
bug #969: workaround abiguous calls to Ref using enable_if.
This commit is contained in:
24
test/ref.cpp
24
test/ref.cpp
@@ -229,6 +229,28 @@ void call_ref()
|
||||
VERIFY_EVALUATION_COUNT( call_ref_7(c,c), 0);
|
||||
}
|
||||
|
||||
typedef Matrix<double,Dynamic,Dynamic,RowMajor> RowMatrixXd;
|
||||
int test_ref_overload_fun1(Ref<MatrixXd> ) { return 1; }
|
||||
int test_ref_overload_fun1(Ref<RowMatrixXd> ) { return 2; }
|
||||
int test_ref_overload_fun1(Ref<MatrixXf> ) { return 3; }
|
||||
|
||||
int test_ref_overload_fun2(Ref<const MatrixXd> ) { return 4; }
|
||||
int test_ref_overload_fun2(Ref<const MatrixXf> ) { return 5; }
|
||||
|
||||
// See also bug 969
|
||||
void test_ref_overloads()
|
||||
{
|
||||
MatrixXd Ad, Bd;
|
||||
RowMatrixXd rAd, rBd;
|
||||
VERIFY( test_ref_overload_fun1(Ad)==1 );
|
||||
VERIFY( test_ref_overload_fun1(rAd)==2 );
|
||||
|
||||
MatrixXf Af, Bf;
|
||||
VERIFY( test_ref_overload_fun2(Ad)==4 );
|
||||
VERIFY( test_ref_overload_fun2(Ad+Bd)==4 );
|
||||
VERIFY( test_ref_overload_fun2(Af+Bf)==5 );
|
||||
}
|
||||
|
||||
void test_ref()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
@@ -249,4 +271,6 @@ void test_ref()
|
||||
CALL_SUBTEST_5( ref_matrix(MatrixXi(internal::random<int>(1,10),internal::random<int>(1,10))) );
|
||||
CALL_SUBTEST_6( call_ref() );
|
||||
}
|
||||
|
||||
CALL_SUBTEST_7( test_ref_overloads() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user