]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/algorithm/test/find_if_not_test1.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / algorithm / test / find_if_not_test1.cpp
index 1a17d959233b8de06f741dc8c5c4887ea6b98e1b..2d79555e9bf7179b16cdbaad26e3f392c4a8a482 100644 (file)
 namespace ba = boost::algorithm;
 // namespace ba = boost;
 
+BOOST_CXX14_CONSTEXPR bool is_true  ( int v ) { return true; }
+BOOST_CXX14_CONSTEXPR bool is_false ( int v ) { return false; }
+BOOST_CXX14_CONSTEXPR bool is_not_three ( int v ) { return v != 3; }
+
+BOOST_CXX14_CONSTEXPR bool check_constexpr() {
+    int in_data[] = {1, 2, 3, 4, 5};
+    bool res = true;
+
+    const int* from = in_data;
+    const int* to = in_data + 5;
+    
+    const int* start = ba::find_if_not (from, to, is_false); // stops on first
+    res = (res && start == from);
+    
+    const int* end = ba::find_if_not(from, to, is_true); // stops on the end
+    res = (res && end == to);
+    
+    const int* three = ba::find_if_not(from, to, is_not_three); // stops on third element
+    res = (res && three == in_data + 2);
+    
+    return res;
+}
+
 template <typename Container>
 typename Container::iterator offset_to_iter ( Container &v, int offset ) {
     typename Container::iterator retval;