]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/foreach/test/pair_byval_r.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / foreach / test / pair_byval_r.cpp
1 // (C) Copyright Eric Niebler 2004.
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 /*
7 Revision history:
8 25 August 2005 : Initial version.
9 */
10
11 #include <boost/test/minimal.hpp>
12 #include <boost/foreach.hpp>
13
14 ///////////////////////////////////////////////////////////////////////////////
15 // define the container types, used by utility.hpp to generate the helper functions
16 typedef std::pair<int*,int*> foreach_container_type;
17 typedef std::pair<int const*,int const*> const foreach_const_container_type;
18 typedef int foreach_value_type;
19 typedef int &foreach_reference_type;
20 typedef int const &foreach_const_reference_type;
21
22 #include "./utility.hpp"
23
24 ///////////////////////////////////////////////////////////////////////////////
25 // define some containers
26 //
27 int my_array[] = { 1,2,3,4,5 };
28 std::pair<int*,int*> my_pair(my_array,my_array+5);
29 std::pair<int const*,int const*> const my_const_pair(my_array,my_array+5);
30
31 ///////////////////////////////////////////////////////////////////////////////
32 // test_main
33 //
34 int test_main( int, char*[] )
35 {
36 boost::mpl::true_ *p = BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(my_pair);
37 (void)p;
38
39 // non-const containers by value
40 BOOST_CHECK(sequence_equal_byval_n_r(my_pair, "\5\4\3\2\1"));
41
42 // const containers by value
43 BOOST_CHECK(sequence_equal_byval_c_r(my_const_pair, "\5\4\3\2\1"));
44
45 return 0;
46 }