1 | /////////////////////////////////////////////////////////////////////////////// |
---|
2 | // utility.hpp header file |
---|
3 | // |
---|
4 | // Copyright 2005 Eric Niebler. |
---|
5 | // Distributed under the Boost Software License, Version 1.0. (See |
---|
6 | // accompanying file LICENSE_1_0.txt or copy at |
---|
7 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
8 | // |
---|
9 | |
---|
10 | #ifndef BOOST_FOREACH_TEST_UTILITY_HPP |
---|
11 | #define BOOST_FOREACH_TEST_UTILITY_HPP |
---|
12 | |
---|
13 | #include <boost/config.hpp> |
---|
14 | #include <boost/foreach.hpp> |
---|
15 | |
---|
16 | /////////////////////////////////////////////////////////////////////////////// |
---|
17 | // sequence_equal_byval_n |
---|
18 | inline bool sequence_equal_byval_n( foreach_container_type & rng, char const * result ) |
---|
19 | { |
---|
20 | BOOST_FOREACH( foreach_value_type i, rng ) |
---|
21 | { |
---|
22 | if(0 == *result || i != *result) |
---|
23 | return false; |
---|
24 | ++result; |
---|
25 | } |
---|
26 | return 0 == *result; |
---|
27 | } |
---|
28 | |
---|
29 | /////////////////////////////////////////////////////////////////////////////// |
---|
30 | // sequence_equal_byval_c |
---|
31 | inline bool sequence_equal_byval_c( foreach_const_container_type & rng, char const * result ) |
---|
32 | { |
---|
33 | BOOST_FOREACH( foreach_value_type i, rng ) |
---|
34 | { |
---|
35 | if(0 == *result || i != *result) |
---|
36 | return false; |
---|
37 | ++result; |
---|
38 | } |
---|
39 | return 0 == *result; |
---|
40 | } |
---|
41 | |
---|
42 | /////////////////////////////////////////////////////////////////////////////// |
---|
43 | // sequence_equal_byref_n |
---|
44 | inline bool sequence_equal_byref_n( foreach_container_type & rng, char const * result ) |
---|
45 | { |
---|
46 | BOOST_FOREACH( foreach_reference_type i, rng ) |
---|
47 | { |
---|
48 | if(0 == *result || i != *result) |
---|
49 | return false; |
---|
50 | ++result; |
---|
51 | } |
---|
52 | return 0 == *result; |
---|
53 | } |
---|
54 | |
---|
55 | /////////////////////////////////////////////////////////////////////////////// |
---|
56 | // sequence_equal_byref_c |
---|
57 | inline bool sequence_equal_byref_c( foreach_const_container_type & rng, char const * result ) |
---|
58 | { |
---|
59 | BOOST_FOREACH( foreach_const_reference_type i, rng ) |
---|
60 | { |
---|
61 | if(0 == *result || i != *result) |
---|
62 | return false; |
---|
63 | ++result; |
---|
64 | } |
---|
65 | return 0 == *result; |
---|
66 | } |
---|
67 | |
---|
68 | /////////////////////////////////////////////////////////////////////////////// |
---|
69 | // mutate_foreach_byref |
---|
70 | // |
---|
71 | inline void mutate_foreach_byref( foreach_container_type & rng ) |
---|
72 | { |
---|
73 | BOOST_FOREACH( foreach_reference_type i, rng ) |
---|
74 | { |
---|
75 | ++i; |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | #endif |
---|