mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
remove EIGEN_HAS_CXX11
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
cfdb3ce3f0
commit
ec4efbd696
@@ -18,28 +18,7 @@ make_reverse_iterator( Iterator i )
|
||||
return std::reverse_iterator<Iterator>(i);
|
||||
}
|
||||
|
||||
#if !EIGEN_HAS_CXX11
|
||||
template<class ForwardIt>
|
||||
ForwardIt is_sorted_until(ForwardIt firstIt, ForwardIt lastIt)
|
||||
{
|
||||
if (firstIt != lastIt) {
|
||||
ForwardIt next = firstIt;
|
||||
while (++next != lastIt) {
|
||||
if (*next < *firstIt)
|
||||
return next;
|
||||
firstIt = next;
|
||||
}
|
||||
}
|
||||
return lastIt;
|
||||
}
|
||||
template<class ForwardIt>
|
||||
bool is_sorted(ForwardIt firstIt, ForwardIt lastIt)
|
||||
{
|
||||
return ::is_sorted_until(firstIt, lastIt) == lastIt;
|
||||
}
|
||||
#else
|
||||
using std::is_sorted;
|
||||
#endif
|
||||
|
||||
template<typename XprType>
|
||||
bool is_pointer_based_stl_iterator(const internal::pointer_based_stl_iterator<XprType> &) { return true; }
|
||||
@@ -50,10 +29,8 @@ bool is_generic_randaccess_stl_iterator(const internal::generic_randaccess_stl_i
|
||||
template<typename Iter>
|
||||
bool is_default_constructible_and_assignable(const Iter& it)
|
||||
{
|
||||
#if EIGEN_HAS_CXX11
|
||||
VERIFY(std::is_default_constructible<Iter>::value);
|
||||
VERIFY(std::is_nothrow_default_constructible<Iter>::value);
|
||||
#endif
|
||||
Iter it2;
|
||||
it2 = it;
|
||||
return (it==it2);
|
||||
@@ -82,12 +59,10 @@ void check_begin_end_for_loop(Xpr xpr)
|
||||
typename Xpr::const_iterator cit = xpr.begin();
|
||||
cit = xpr.cbegin();
|
||||
|
||||
#if EIGEN_HAS_CXX11
|
||||
auto tmp1 = xpr.begin();
|
||||
VERIFY(tmp1==xpr.begin());
|
||||
auto tmp2 = xpr.cbegin();
|
||||
VERIFY(tmp2==xpr.cbegin());
|
||||
#endif
|
||||
}
|
||||
|
||||
VERIFY( xpr.end() -xpr.begin() == xpr.size() );
|
||||
@@ -123,9 +98,7 @@ template<typename Scalar, int Rows, int Cols>
|
||||
void test_stl_iterators(int rows=Rows, int cols=Cols)
|
||||
{
|
||||
typedef Matrix<Scalar,Rows,1> VectorType;
|
||||
#if EIGEN_HAS_CXX11
|
||||
typedef Matrix<Scalar,1,Cols> RowVectorType;
|
||||
#endif
|
||||
typedef Matrix<Scalar,Rows,Cols,ColMajor> ColMatrixType;
|
||||
typedef Matrix<Scalar,Rows,Cols,RowMajor> RowMatrixType;
|
||||
VectorType v = VectorType::Random(rows);
|
||||
@@ -191,7 +164,6 @@ void test_stl_iterators(int rows=Rows, int cols=Cols)
|
||||
check_begin_end_for_loop(v+v);
|
||||
}
|
||||
|
||||
#if EIGEN_HAS_CXX11
|
||||
// check swappable
|
||||
{
|
||||
using std::swap;
|
||||
@@ -326,8 +298,6 @@ void test_stl_iterators(int rows=Rows, int cols=Cols)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if(rows>=3) {
|
||||
VERIFY_IS_EQUAL((v.begin()+rows/2)[1], v(rows/2+1));
|
||||
|
||||
@@ -344,11 +314,7 @@ void test_stl_iterators(int rows=Rows, int cols=Cols)
|
||||
if(rows>=2)
|
||||
{
|
||||
v(1) = v(0)-Scalar(1);
|
||||
#if EIGEN_HAS_CXX11
|
||||
VERIFY(!is_sorted(std::begin(v),std::end(v)));
|
||||
#else
|
||||
VERIFY(!is_sorted(v.cbegin(),v.cend()));
|
||||
#endif
|
||||
}
|
||||
|
||||
// on a vector
|
||||
@@ -428,7 +394,6 @@ void test_stl_iterators(int rows=Rows, int cols=Cols)
|
||||
VERIFY_IS_APPROX(v1(rows/4), v(rows/4));
|
||||
}
|
||||
|
||||
#if EIGEN_HAS_CXX11
|
||||
// check rows/cols iterators with range-for loops
|
||||
{
|
||||
j = 0;
|
||||
@@ -492,12 +457,9 @@ void test_stl_iterators(int rows=Rows, int cols=Cols)
|
||||
STATIC_CHECK(( internal::is_same<VecOp::const_iterator, decltype(std::cend (std::declval<const VecOp&>()))>::value ));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if EIGEN_HAS_CXX11
|
||||
// When the compiler sees expression IsContainerTest<C>(0), if C is an
|
||||
// STL-style container class, the first overload of IsContainerTest
|
||||
// will be viable (since both C::iterator* and C::const_iterator* are
|
||||
@@ -545,7 +507,6 @@ void test_stl_container_detection(int rows=Rows, int cols=Cols)
|
||||
VERIFY_IS_EQUAL(IsContainerType<ColMatrixType>(0), rows == 1 || cols == 1);
|
||||
VERIFY_IS_EQUAL(IsContainerType<RowMatrixType>(0), rows == 1 || cols == 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
EIGEN_DECLARE_TEST(stl_iterators)
|
||||
{
|
||||
@@ -555,9 +516,7 @@ EIGEN_DECLARE_TEST(stl_iterators)
|
||||
CALL_SUBTEST_1(( test_stl_iterators<int,Dynamic,Dynamic>(internal::random<int>(5,10), internal::random<int>(5,10)) ));
|
||||
CALL_SUBTEST_1(( test_stl_iterators<int,Dynamic,Dynamic>(internal::random<int>(10,200), internal::random<int>(10,200)) ));
|
||||
}
|
||||
|
||||
#if EIGEN_HAS_CXX11
|
||||
|
||||
CALL_SUBTEST_1(( test_stl_container_detection<float,1,1>() ));
|
||||
CALL_SUBTEST_1(( test_stl_container_detection<float,5,5>() ));
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user