]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/foreach/test/array_byref.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / foreach / test / array_byref.cpp
CommitLineData
7c673cae
FG
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
1e59de90 11#include <boost/core/lightweight_test.hpp>
7c673cae
FG
12#include <boost/foreach.hpp>
13
14///////////////////////////////////////////////////////////////////////////////
15// define the container types, used by utility.hpp to generate the helper functions
16typedef int foreach_container_type[5];
17typedef int const foreach_const_container_type[5];
18typedef int foreach_value_type;
19typedef int &foreach_reference_type;
20typedef int const &foreach_const_reference_type;
21
22#include "./utility.hpp"
23
24///////////////////////////////////////////////////////////////////////////////
25// define some containers
26//
27int my_array[5] = { 1,2,3,4,5 };
28int const (&my_const_array)[5] = my_array;
29
30///////////////////////////////////////////////////////////////////////////////
31// test_main
32//
1e59de90 33int main()
7c673cae
FG
34{
35 // non-const containers by reference
1e59de90 36 BOOST_TEST(sequence_equal_byref_n(my_array, "\1\2\3\4\5"));
7c673cae
FG
37
38 // const containers by reference
1e59de90 39 BOOST_TEST(sequence_equal_byref_c(my_const_array, "\1\2\3\4\5"));
7c673cae
FG
40
41 // mutate the mutable collections
42 mutate_foreach_byref(my_array);
43
44 // compare the mutated collections to the actual results
1e59de90 45 BOOST_TEST(sequence_equal_byref_n(my_array, "\2\3\4\5\6"));
7c673cae 46
1e59de90 47 return boost::report_errors();
7c673cae 48}