1 | // Boost.Assign library |
2 | // |
3 | // Copyright Thorsten Ottosen 2003-2004. Use, modification and |
4 | // distribution is subject to the Boost Software License, Version |
5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
6 | // http://www.boost.org/LICENSE_1_0.txt) |
7 | // |
8 | // For more information, see http://www.boost.org/libs/assign/ |
9 | // |
10 | |
11 | |
12 | #include <boost/detail/workaround.hpp> |
13 | |
14 | #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) |
15 | # pragma warn -8091 // suppress warning in Boost.Test |
16 | # pragma warn -8057 // unused argument argc/argv in Boost.Test |
17 | #endif |
18 | |
19 | #include <boost/assign/list_of.hpp> |
20 | #include <boost/test/test_tools.hpp> |
21 | #include <vector> |
22 | #include <set> |
23 | #include <map> |
24 | #include <stack> |
25 | #include <queue> |
26 | #include <boost/array.hpp> |
27 | |
28 | void check_list_of() |
29 | { |
30 | using namespace std; |
31 | using namespace boost; |
32 | using namespace boost::assign; |
33 | using boost::array; |
34 | |
35 | vector<int> v = list_of(t: 1)(2)(3)(4).to_container( c&: v ); |
36 | set<int> s = list_of(t: 1)(2)(3)(4).to_container( c&: s ); |
37 | map<int,int> m = map_list_of(k: 1,t: 2)(2,3).to_container( c&: m ); |
38 | stack<int> st = list_of(t: 1)(2)(3)(4).to_adapter( a&: st ); |
39 | queue<int> q = list_of(t: 1)(2)(3)(4).to_adapter( a&: q ); |
40 | array<int,4> a = list_of(t: 1)(2)(3)(4).to_array( a ); |
41 | const vector<int> v2 = list_of(t: 1).to_container( c: v2 ); |
42 | const array<int,1> a2 = list_of(t: 1).to_array( a: a2 ); |
43 | } |
44 | |
45 | |
46 | |
47 | #include <boost/test/unit_test.hpp> |
48 | using boost::unit_test::test_suite; |
49 | |
50 | test_suite* init_unit_test_suite( int argc, char* argv[] ) |
51 | { |
52 | test_suite* test = BOOST_TEST_SUITE( "List Test Suite" ); |
53 | |
54 | test->add( BOOST_TEST_CASE( &check_list_of ) ); |
55 | |
56 | return test; |
57 | } |
58 | |
59 | |
60 | |