Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/tr1/test/test_reference_wrapper.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1016 bytes
Line 
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
16int 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}
Note: See TracBrowser for help on using the repository browser.