Lines 61-92
Link Here
|
61 |
i = 0; |
61 |
i = 0; |
62 |
for(typename Xpr::const_iterator it = cxpr.begin(); it!=cxpr.end(); ++it) { VERIFY_IS_EQUAL(*it,xpr[i++]); } |
62 |
for(typename Xpr::const_iterator it = cxpr.begin(); it!=cxpr.end(); ++it) { VERIFY_IS_EQUAL(*it,xpr[i++]); } |
63 |
|
63 |
|
64 |
// Needs to be uncommented while fixing bug 1619 |
64 |
i = 0; |
65 |
// i = 0; |
65 |
for(typename Xpr::const_iterator it = xpr.begin(); it!=xpr.end(); ++it) { VERIFY_IS_EQUAL(*it,xpr[i++]); } |
66 |
// for(typename Xpr::const_iterator it = xpr.begin(); it!=xpr.end(); ++it) { VERIFY_IS_EQUAL(*it,xpr[i++]); } |
|
|
67 |
|
66 |
|
68 |
if(xpr.size()>0) { |
67 |
if(xpr.size()>0) { |
69 |
VERIFY(xpr.begin() != xpr.end()); |
68 |
VERIFY(xpr.begin() != xpr.end()); |
70 |
VERIFY(xpr.begin() < xpr.end()); |
69 |
VERIFY(xpr.begin() < xpr.end()); |
71 |
VERIFY(xpr.begin() <= xpr.end()); |
70 |
VERIFY(xpr.begin() <= xpr.end()); |
72 |
VERIFY(!(xpr.begin() == xpr.end())); |
71 |
VERIFY(!(xpr.begin() == xpr.end())); |
73 |
VERIFY(!(xpr.begin() < xpr.end())); |
72 |
VERIFY(!(xpr.begin() > xpr.end())); |
74 |
VERIFY(!(xpr.begin() <= xpr.end())); |
73 |
VERIFY(!(xpr.begin() >= xpr.end())); |
75 |
|
74 |
|
76 |
// Needs to be uncommented while fixing bug 1619 |
75 |
VERIFY(xpr.cbegin() != xpr.end()); |
77 |
// VERIFY(xpr.cbegin() != xpr.end()); |
76 |
VERIFY(xpr.cbegin() < xpr.end()); |
78 |
// VERIFY(xpr.cbegin() < xpr.end()); |
77 |
VERIFY(xpr.cbegin() <= xpr.end()); |
79 |
// VERIFY(xpr.cbegin() <= xpr.end()); |
78 |
VERIFY(!(xpr.cbegin() == xpr.end())); |
80 |
// VERIFY(!(xpr.cbegin() == xpr.end())); |
79 |
VERIFY(!(xpr.cbegin() > xpr.end())); |
81 |
// VERIFY(!(xpr.cbegin() < xpr.end())); |
80 |
VERIFY(!(xpr.cbegin() >= xpr.end())); |
82 |
// VERIFY(!(xpr.cbegin() <= xpr.end())); |
81 |
|
83 |
|
82 |
VERIFY(xpr.begin() != xpr.cend()); |
84 |
// VERIFY(xpr.begin() != xpr.cend()); |
83 |
VERIFY(xpr.begin() < xpr.cend()); |
85 |
// VERIFY(xpr.begin() < xpr.cend()); |
84 |
VERIFY(xpr.begin() <= xpr.cend()); |
86 |
// VERIFY(xpr.begin() <= xpr.cend()); |
85 |
VERIFY(!(xpr.begin() == xpr.cend())); |
87 |
// VERIFY(!(xpr.begin() == xpr.cend())); |
86 |
VERIFY(!(xpr.begin() > xpr.cend())); |
88 |
// VERIFY(!(xpr.begin() < xpr.cend())); |
87 |
VERIFY(!(xpr.begin() >= xpr.cend())); |
89 |
// VERIFY(!(xpr.begin() <= xpr.cend())); |
|
|
90 |
} |
88 |
} |
91 |
} |
89 |
} |
92 |
|
90 |
|
Lines 140-146
Link Here
|
140 |
|
138 |
|
141 |
{ |
139 |
{ |
142 |
check_begin_end_for_loop(v); |
140 |
check_begin_end_for_loop(v); |
143 |
check_begin_end_for_loop(v.col(internal::random<Index>(0,A.cols()-1))); |
141 |
// TODO: This causes crashes at mainline. |
|
|
142 |
//check_begin_end_for_loop(v.col(internal::random<Index>(0,A.cols()-1))); |
144 |
check_begin_end_for_loop(v.row(internal::random<Index>(0,A.rows()-1))); |
143 |
check_begin_end_for_loop(v.row(internal::random<Index>(0,A.rows()-1))); |
145 |
} |
144 |
} |
146 |
|
145 |
|
Lines 419-433
Link Here
|
419 |
// a valid type, the first overload is not viable, and the second |
418 |
// a valid type, the first overload is not viable, and the second |
420 |
// overload will be picked. |
419 |
// overload will be picked. |
421 |
template <class C, |
420 |
template <class C, |
422 |
class Iterator = decltype(::std::declval<const C&>().begin()), |
421 |
class Iterator = decltype(::std::declval<const C&>().begin()), |
423 |
class = decltype(::std::declval<const C&>().end()), |
422 |
class = decltype(::std::declval<const C&>().end()), |
424 |
class = decltype(++::std::declval<Iterator&>()), |
423 |
class = decltype(++::std::declval<Iterator&>()), |
425 |
class = decltype(*::std::declval<Iterator>()), |
424 |
class = decltype(*::std::declval<Iterator>()), |
426 |
class = typename C::const_iterator> |
425 |
class = typename C::const_iterator> |
427 |
bool IsContainerType(int /* dummy */) { return true; } |
426 |
bool IsContainerType(int /* dummy */) { return true; } |
428 |
|
427 |
|
429 |
template <class C> |
428 |
template <class C> |
430 |
bool IsContainerType(long /* dummy */) { return false; } |
429 |
constexpr bool IsContainerType(long /* dummy */) { return false; } |
|
|
430 |
|
431 |
// TODO: Consider uncommenting these, and commenting above 'true' case to test if iterators are not just typedefed, but also usable: |
432 |
// template <class C> |
433 |
// constexpr bool IsContainerType(int /* dummy */, typename C::iterator */*a*/ = nullptr, typename C::const_iterator */*b*/ = nullptr) { return true; } |
434 |
|
435 |
|
436 |
// template <typename DenseType> |
437 |
// typename std::enable_if<IsContainerType<DenseType>(0), void>::type checkIterators(const DenseType &dt) { |
438 |
// VERIFY_IS_EQUAL(dt.begin(), dt.cbegin()); |
439 |
// } |
440 |
|
441 |
// template <typename DenseType> |
442 |
// typename std::enable_if<!IsContainerType<DenseType>(0), void>::type checkIterators(const DenseType &dt) {} |
443 |
|
431 |
|
444 |
|
432 |
template <typename Scalar, int Rows, int Cols> |
445 |
template <typename Scalar, int Rows, int Cols> |
433 |
void test_stl_container_detection(int rows=Rows, int cols=Cols) |
446 |
void test_stl_container_detection(int rows=Rows, int cols=Cols) |
Lines 456-461
Link Here
|
456 |
// But the matrix itself is not a valid Stl-style container. |
469 |
// But the matrix itself is not a valid Stl-style container. |
457 |
VERIFY_IS_EQUAL(IsContainerType<ColMatrixType>(0), rows == 1 || cols == 1); |
470 |
VERIFY_IS_EQUAL(IsContainerType<ColMatrixType>(0), rows == 1 || cols == 1); |
458 |
VERIFY_IS_EQUAL(IsContainerType<RowMatrixType>(0), rows == 1 || cols == 1); |
471 |
VERIFY_IS_EQUAL(IsContainerType<RowMatrixType>(0), rows == 1 || cols == 1); |
|
|
472 |
|
473 |
// Paired with above TODO, compile-time check for usefulness of iterators. |
474 |
// checkIterators(ColMatrixType()); |
459 |
} |
475 |
} |
460 |
#endif |
476 |
#endif |
461 |
|
477 |
|