1 | // Copyright 2021 Peter Dimov. |
---|---|
2 | // Distributed under the Boost Software License, Version 1.0. |
3 | // https://www.boost.org/LICENSE_1_0.txt |
4 | |
5 | #include <boost/system/result.hpp> |
6 | #include <boost/core/lightweight_test.hpp> |
7 | #include <vector> |
8 | |
9 | using namespace boost::system; |
10 | |
11 | result<std::vector<int>> f() |
12 | { |
13 | return std::vector<int>{ 1, 2, 3 }; |
14 | } |
15 | |
16 | int main() |
17 | { |
18 | { |
19 | int s = 0; |
20 | |
21 | for( int x: f().value() ) |
22 | { |
23 | s += x; |
24 | } |
25 | |
26 | BOOST_TEST_EQ( s, 6 ); |
27 | } |
28 | |
29 | return boost::report_errors(); |
30 | } |
31 |