aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/stl_iterators.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2019-11-14 11:45:52 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2019-11-14 11:45:52 +0100
commit8af045a28721a9401d423c0318ffb99696c78f31 (patch)
treea00a0f9a10ad34ae54064a648606cdd66c6545f5 /test/stl_iterators.cpp
parent75b4c0a3e0ce69d8908c9b7daf644d797a3b9c0d (diff)
bug #1774: fix VectorwiseOp::begin()/end() return types regarding constness.
Diffstat (limited to 'test/stl_iterators.cpp')
-rw-r--r--test/stl_iterators.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/stl_iterators.cpp b/test/stl_iterators.cpp
index 5fef34c0d..cdd9e5c33 100644
--- a/test/stl_iterators.cpp
+++ b/test/stl_iterators.cpp
@@ -1,12 +1,13 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
-// Copyright (C) 2018 Gael Guennebaud <gael.guennebaud@inria.fr>
+// Copyright (C) 2018-2019 Gael Guennebaud <gael.guennebaud@inria.fr>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#include <iterator>
#include <numeric>
#include "main.h"
@@ -422,6 +423,16 @@ void test_stl_iterators(int rows=Rows, int cols=Cols)
VERIFY_IS_EQUAL( std::find_if(A.colwise().begin(), A.colwise().end(), [](typename ColMatrixType::ColXpr x) { return x.norm() == Scalar(0); })-A.colwise().begin(), j );
}
+ {
+ using VecOp = VectorwiseOp<ArrayXXi, 0>;
+ STATIC_CHECK(( internal::is_same<VecOp::const_iterator, decltype(std::declval<const VecOp&>().cbegin())>::value ));
+ STATIC_CHECK(( internal::is_same<VecOp::const_iterator, decltype(std::declval<const VecOp&>().cend ())>::value ));
+ #if EIGEN_COMP_CXXVER>=14
+ STATIC_CHECK(( internal::is_same<VecOp::const_iterator, decltype(std::cbegin(std::declval<const VecOp&>()))>::value ));
+ STATIC_CHECK(( internal::is_same<VecOp::const_iterator, decltype(std::cend (std::declval<const VecOp&>()))>::value ));
+ #endif
+ }
+
#endif
}