• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
11 #define BOOST_ALLOW_DEPRECATED_HEADERS
12 #include <boost/range/reverse_result_iterator.hpp>
13 #include <boost/static_assert.hpp>
14 #include <boost/type_traits/is_same.hpp>
15 
16 #include <boost/test/test_tools.hpp>
17 #include <boost/test/unit_test.hpp>
18 
19 #include <vector>
20 
21 namespace boost_range_test
22 {
23     namespace
24     {
25 
test_reverse_result_iterator()26 void test_reverse_result_iterator()
27 {
28     typedef std::vector<int> cont;
29 
30     BOOST_STATIC_ASSERT((
31         boost::is_same<
32             boost::reverse_iterator<cont::iterator>,
33             boost::range_reverse_result_iterator<cont>::type
34         >::value));
35 
36     BOOST_STATIC_ASSERT((
37         boost::is_same<
38             boost::reverse_iterator<cont::const_iterator>,
39             boost::range_reverse_result_iterator<const cont>::type
40         >::value));
41 
42 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
43     BOOST_STATIC_ASSERT((
44         boost::is_same<
45             boost::reverse_iterator<cont::iterator>,
46             boost::range_reverse_result_iterator<cont&&>::type
47         >::value));
48 #endif
49 }
50 
51     } // anonymous namespace
52 } // namespace boost_range_test
53 
init_unit_test_suite(int argc,char * argv[])54 boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
55 {
56     boost::unit_test::test_suite* test =
57         BOOST_TEST_SUITE(
58                 "Boost.Range range_reverse_result_iterator meta-function");
59 
60     test->add(BOOST_TEST_CASE(&boost_range_test::test_reverse_result_iterator));
61 
62     return test;
63 }
64