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/core/lightweight_test.hpp> |
12 | #include <boost/foreach.hpp> |
13 | |
14 | /////////////////////////////////////////////////////////////////////////////// |
15 | // define the container types, used by utility.hpp to generate the helper functions |
16 | typedef int foreach_container_type[5]; |
17 | typedef int const foreach_const_container_type[5]; |
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[5] = { 1,2,3,4,5 }; |
28 | int const (&my_const_array)[5] = my_array; |
29 | |
30 | /////////////////////////////////////////////////////////////////////////////// |
31 | // test_main |
32 | // |
33 | int main() |
34 | { |
35 | boost::mpl::false_ *p = BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(my_array); |
36 | (void)p; |
37 | |
38 | // non-const containers by value |
39 | BOOST_TEST(sequence_equal_byval_n_r(my_array, "\5\4\3\2\1" )); |
40 | |
41 | // const containers by value |
42 | BOOST_TEST(sequence_equal_byval_c_r(my_const_array, "\5\4\3\2\1" )); |
43 | |
44 | return boost::report_errors(); |
45 | } |
46 | |