]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/test/value_type.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / range / test / value_type.cpp
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/value_type.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
25 void test_value_type()
26 {
27 typedef std::vector<int> cont;
28
29 BOOST_STATIC_ASSERT((
30 boost::is_same<
31 cont::value_type,
32 boost::range_value<cont>::type
33 >::value));
34
35 BOOST_STATIC_ASSERT((
36 boost::is_same<
37 cont::value_type,
38 boost::range_value<const cont>::type
39 >::value));
40
41 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
42 BOOST_STATIC_ASSERT((
43 boost::is_same<
44 cont::value_type,
45 boost::range_value<cont&&>::type
46 >::value));
47 #endif
48 }
49
50 } // anonymous namespace
51 } // namespace boost_range_test
52
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_value meta-function");
57
58 test->add(BOOST_TEST_CASE(&boost_range_test::test_value_type));
59
60 return test;
61 }