]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/tr1/test/test_reference_wrapper.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / tr1 / test / test_reference_wrapper.cpp
1 // (C) Copyright John Maddock 2005.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifdef TEST_STD_HEADERS
7 #include <functional>
8 #else
9 #include <boost/tr1/functional.hpp>
10 #endif
11
12 #include <boost/static_assert.hpp>
13 #include <boost/type_traits/is_convertible.hpp>
14 #include <boost/type_traits/is_same.hpp>
15
16 int main()
17 {
18 typedef std::tr1::reference_wrapper<int> rr_type;
19 typedef std::tr1::reference_wrapper<const int> crr_type;
20
21 int i, j;
22 rr_type r1 = std::tr1::ref(i);
23 crr_type r2 = std::tr1::cref(i);
24 r1 = std::tr1::ref(j);
25
26 int& ref = r1.get();
27
28 BOOST_STATIC_ASSERT((::boost::is_convertible<rr_type, int&>::value));
29 BOOST_STATIC_ASSERT((::boost::is_convertible<crr_type, const int&>::value));
30 BOOST_STATIC_ASSERT((::boost::is_same<rr_type::type, int>::value));
31 BOOST_STATIC_ASSERT((::boost::is_same<crr_type::type, const int>::value));
32 }