reverse_result_iterator.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Boost.Range library
  2. //
  3. // Copyright Neil Groves 2014. Use, modification and
  4. // distribution is subject to the Boost Software License, Version
  5. // 1.0. (See accompanying file 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 <boost/range/reverse_result_iterator.hpp>
  11. #include <boost/static_assert.hpp>
  12. #include <boost/type_traits/is_same.hpp>
  13. #include <boost/test/test_tools.hpp>
  14. #include <boost/test/unit_test.hpp>
  15. #include <vector>
  16. namespace boost_range_test
  17. {
  18. namespace
  19. {
  20. void test_reverse_result_iterator()
  21. {
  22. typedef std::vector<int> cont;
  23. BOOST_STATIC_ASSERT((
  24. boost::is_same<
  25. boost::reverse_iterator<cont::iterator>,
  26. boost::range_reverse_result_iterator<cont>::type
  27. >::value));
  28. BOOST_STATIC_ASSERT((
  29. boost::is_same<
  30. boost::reverse_iterator<cont::const_iterator>,
  31. boost::range_reverse_result_iterator<const cont>::type
  32. >::value));
  33. #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
  34. BOOST_STATIC_ASSERT((
  35. boost::is_same<
  36. boost::reverse_iterator<cont::iterator>,
  37. boost::range_reverse_result_iterator<cont&&>::type
  38. >::value));
  39. #endif
  40. }
  41. } // anonymous namespace
  42. } // namespace boost_range_test
  43. boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
  44. {
  45. boost::unit_test::test_suite* test =
  46. BOOST_TEST_SUITE(
  47. "Boost.Range range_reverse_result_iterator meta-function");
  48. test->add(BOOST_TEST_CASE(&boost_range_test::test_reverse_result_iterator));
  49. return test;
  50. }