]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/test/adaptor_test/ref_unwrapped.cpp
3 // Copyright Robin Eckert 2015. Use, modification and distribution is
4 // subject to the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
9 // For more information, see http://www.boost.org/libs/range/
11 #include <boost/range/adaptor/ref_unwrapped.hpp>
13 #define BOOST_TEST_MAIN
15 #include <boost/test/test_tools.hpp>
16 #include <boost/test/unit_test.hpp>
20 #if !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && !defined(BOOST_NO_CXX11_RANGE_BASED_FOR) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
25 BOOST_AUTO_TEST_CASE(test_mutable
)
31 std::vector
<std::reference_wrapper
<int>> input_values
{one
, two
, three
};
33 const std::vector
<int*> expected
{&one
, &two
, &three
};
34 std::vector
<int*> actual
;
36 for (auto&& value
: input_values
| adaptors::ref_unwrapped
)
38 actual
.push_back(&value
);
41 BOOST_CHECK_EQUAL_COLLECTIONS(expected
.begin(),
47 BOOST_AUTO_TEST_CASE(test_const_range
)
53 const std::vector
<std::reference_wrapper
<int>> input_values
{one
, two
, three
};
55 const std::vector
<int*> expected
{&one
, &two
, &three
};
56 std::vector
<int*> actual
;
58 for (auto&& value
: input_values
| adaptors::ref_unwrapped
)
60 actual
.push_back(&value
);
63 BOOST_CHECK_EQUAL_COLLECTIONS(expected
.begin(),
69 BOOST_AUTO_TEST_CASE(test_const_reference
)
75 const std::vector
<std::reference_wrapper
<const int>> input_values
{one
, two
, three
};
77 const std::vector
<const int*> expected
{&one
, &two
, &three
};
78 std::vector
<const int*> actual
;
80 for (auto&& value
: input_values
| adaptors::ref_unwrapped
)
82 actual
.push_back(&value
);
85 BOOST_CHECK_EQUAL_COLLECTIONS(expected
.begin(),
96 BOOST_AUTO_TEST_CASE(empty
)