Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/foreach/test/array_byval.cpp @ 33

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

updated boost from 1_33_1 to 1_34_1

File size: 1.3 KB
Line 
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
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 come 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//   
33int test_main( int, char*[] )
34{
35    boost::mpl::false_ *p = BOOST_FOREACH_IS_LIGHTWEIGHT_PROXY(my_array);
36
37    // non-const containers by value
38    BOOST_CHECK(sequence_equal_byval_n(my_array, "\1\2\3\4\5"));
39
40    // const containers by value
41    BOOST_CHECK(sequence_equal_byval_c(my_const_array, "\1\2\3\4\5"));
42
43    return 0;
44}
Note: See TracBrowser for help on using the repository browser.