adjacent_filtered_concept3.cpp 964 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #include "mock_range.hpp"
  11. #include <boost/range/adaptor/adjacent_filtered.hpp>
  12. namespace
  13. {
  14. struct always_true
  15. {
  16. typedef bool result_type;
  17. bool operator()(int, int) const
  18. {
  19. return true;
  20. }
  21. };
  22. } // anonymous namespace
  23. int main(int, const char**)
  24. {
  25. using boost::range::unit_test::mock_range;
  26. using boost::adaptors::adjacent_filter;
  27. // This next line should fail when Boost.Range concept checking is
  28. // enabled since the adjacent_filtered adaptor takes at least a
  29. // ForwardRange.
  30. return adjacent_filter(
  31. mock_range<boost::single_pass_traversal_tag>(),
  32. always_true()).front();
  33. }