summaryrefslogtreecommitdiff
path: root/libs/algorithm/test/one_of_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/algorithm/test/one_of_test.cpp')
-rw-r--r--libs/algorithm/test/one_of_test.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/libs/algorithm/test/one_of_test.cpp b/libs/algorithm/test/one_of_test.cpp
index ccc3a9774d..8403a8ee26 100644
--- a/libs/algorithm/test/one_of_test.cpp
+++ b/libs/algorithm/test/one_of_test.cpp
@@ -19,9 +19,8 @@
template<typename T>
struct is_ {
- is_ ( T v ) : val_ ( v ) {}
- ~is_ () {}
- bool operator () ( T comp ) const { return val_ == comp; }
+ BOOST_CXX14_CONSTEXPR is_ ( T v ) : val_ ( v ) {}
+ BOOST_CXX14_CONSTEXPR bool operator () ( T comp ) const { return val_ == comp; }
private:
is_ (); // need a value
@@ -33,7 +32,7 @@ namespace ba = boost::algorithm;
void test_one ()
{
// Note: The literal values here are tested against directly, careful if you change them:
- int some_numbers[] = { 1, 1, 2, 3, 5 };
+ BOOST_CXX14_CONSTEXPR int some_numbers[] = { 1, 1, 2, 3, 5 };
std::vector<int> vi(some_numbers, some_numbers + 5);
std::list<int> li(vi.begin(), vi.end ());
@@ -92,7 +91,13 @@ void test_one ()
BOOST_CHECK ( ba::one_of ( li.begin(), l_iter, is_<int> ( 2 )));
BOOST_CHECK (!ba::one_of_equal ( li.begin(), l_iter, 3 ));
BOOST_CHECK (!ba::one_of ( li.begin(), l_iter, is_<int> ( 3 )));
+
+ BOOST_CXX14_CONSTEXPR bool constexpr_res =
+ !ba::one_of ( some_numbers, is_<int> ( 6 )) &&
+ ba::one_of ( some_numbers + 1, some_numbers + 3, is_<int> ( 1 )) &&
+ true;
+ BOOST_CHECK ( constexpr_res );
}