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/sequence/intrinsic/at.hpp>
13 #include <boost/fusion/container/generation/make_vector.hpp>
14 #include <boost/fusion/algorithm/transformation/replace.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 replace
27
28 {
29 char const* s = "Ruby";
30 typedef vector<int, char, long, char const*> vector_type;
31 vector_type t1(1, 'x', 3, s);
32
33 {
34 std::cout << replace(t1, 'x', 'y') << std::endl;
35 BOOST_TEST((replace(t1, 'x', 'y')
36 == make_vector(1, 'y', 3, s)));
37 }
38
39 {
40 char const* s2 = "funny";
41 std::cout << replace(t1, s, s2) << std::endl;
42 BOOST_TEST((replace(t1, s, s2)
43 == make_vector(1, 'x', 3, s2)));
44 }
45 }
46
47 return boost::report_errors();
48 }
49
50