2 Copyright (c) Alexander Zaitsev <zamazan4ik@gmail.by>, 2017
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 For more information, see http://www.boost.org
14 #include <boost/algorithm/is_partitioned_until.hpp>
17 namespace ba = boost::algorithm;
19 bool isOdd(const int v1)
26 bool operator()(const int v1) const
33 int main ( int /*argc*/, char * /*argv*/ [] )
35 std::vector<int> good{1, 2, 4};
36 std::vector<int> bad{1, 2, 3};
39 auto it1 = ba::is_partitioned_until(good.begin(), good.end(), isOdd);
42 std::cout << "The sequence is partitioned\n";
46 std::cout << "is_partitioned_until check failed here: " << *it1 << std::endl;
49 //Use custom comparator
50 auto it2 = ba::is_partitioned_until(good.begin(), good.end(), isOddComp());
53 std::cout << "The sequence is partitioned\n";
57 std::cout << "is_partitioned_until check failed here: " << *it2 << std::endl;
60 auto it3 = ba::is_partitioned_until(bad, isOdd);
63 std::cout << "The sequence is partitioned\n";
67 std::cout << "is_partitioned_until check failed here: " << *it3 << std::endl;