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