]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // (C) Copyright Eric Niebler 2005. |
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 <vector> | |
1e59de90 | 12 | #include <boost/core/lightweight_test.hpp> |
7c673cae FG |
13 | #include <boost/foreach.hpp> |
14 | ||
15 | #ifdef BOOST_FOREACH_NO_RVALUE_DETECTION | |
16 | # error Expected failure : rvalues disallowed | |
17 | #else | |
18 | ||
19 | std::vector<int> get_vector() | |
20 | { | |
21 | return std::vector<int>(4, 4); | |
22 | } | |
23 | ||
24 | /////////////////////////////////////////////////////////////////////////////// | |
25 | // test_main | |
26 | // | |
1e59de90 | 27 | int main() |
7c673cae FG |
28 | { |
29 | int counter = 0; | |
30 | ||
31 | BOOST_REVERSE_FOREACH(int i, get_vector()) | |
32 | { | |
33 | counter += i; | |
34 | } | |
35 | ||
1e59de90 | 36 | BOOST_TEST(16 == counter); |
7c673cae | 37 | |
1e59de90 | 38 | return boost::report_errors(); |
7c673cae FG |
39 | } |
40 | ||
41 | #endif |