1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #include <boost/detail/lightweight_test.hpp>
8 #include <boost/fusion/container/vector/vector.hpp>
9 #include <boost/fusion/adapted/mpl.hpp>
10 #include <boost/fusion/sequence/io/out.hpp>
11 #include <boost/fusion/sequence/comparison/equal_to.hpp>
12 #include <boost/fusion/container/generation/make_vector.hpp>
13 #include <boost/fusion/algorithm/transformation/push_front.hpp>
14 #include <boost/mpl/vector_c.hpp>
15 #include <string>
16
17 int
main()18 main()
19 {
20 using namespace boost::fusion;
21
22 std::cout << tuple_open('[');
23 std::cout << tuple_close(']');
24 std::cout << tuple_delimiter(", ");
25
26 /// Testing push_front
27
28 {
29 char const* s = "Ruby";
30 typedef vector<int, char, double, char const*> vector_type;
31 vector_type t1(1, 'x', 3.3, s);
32
33 {
34 std::cout << push_front(t1, 123456) << std::endl;
35 BOOST_TEST((push_front(t1, 123456)
36 == make_vector(123456, 1, 'x', 3.3, s)));
37 }
38
39 {
40 std::cout << push_front(t1, "lively") << std::endl;
41 BOOST_TEST((push_front(t1, "lively")
42 == make_vector(std::string("lively"), 1, 'x', 3.3, s)));
43 }
44 }
45
46 {
47 typedef boost::mpl::vector_c<int, 2, 3, 4, 5, 6> mpl_vec;
48 std::cout << boost::fusion::push_front(mpl_vec(), boost::mpl::int_<1>()) << std::endl;
49 BOOST_TEST((boost::fusion::push_front(mpl_vec(), boost::mpl::int_<1>())
50 == make_vector(1, 2, 3, 4, 5, 6)));
51 }
52
53 return boost::report_errors();
54 }
55
56