| 1 | // Boost.Range library |
| 2 | // |
| 3 | // Copyright Neil Groves 2014. Use, modification and distribution is subject |
| 4 | // to the Boost Software License, Version 1.0. (See accompanying file |
| 5 | // LICENSE_1_0.txt or copy at |
| 6 | // http://www.boost.org/LICENSE_1_0.txt) |
| 7 | // |
| 8 | // For more information, see http://www.boost.org/libs/range |
| 9 | // |
| 10 | |
| 11 | #include "mock_range.hpp" |
| 12 | #include <boost/range/adaptor/adjacent_filtered.hpp> |
| 13 | |
| 14 | namespace |
| 15 | { |
| 16 | |
| 17 | struct always_true |
| 18 | { |
| 19 | typedef bool result_type; |
| 20 | |
| 21 | bool operator()(int, int) const |
| 22 | { |
| 23 | return true; |
| 24 | } |
| 25 | }; |
| 26 | |
| 27 | } // anonymous namespace |
| 28 | |
| 29 | int main(int, const char**) |
| 30 | { |
| 31 | using boost::range::unit_test::mock_const_range; |
| 32 | using boost::adaptors::adjacent_filtered; |
| 33 | |
| 34 | // This next line should fail when Boost.Range concept checking is |
| 35 | // enabled since the adjacent_filtered adaptor takes at least a |
| 36 | // ForwardRange. |
| 37 | return (mock_const_range<boost::single_pass_traversal_tag>() | |
| 38 | adjacent_filtered(always_true())).front(); |
| 39 | } |
| 40 | |