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/adapted/mpl.hpp>
11 #include <boost/fusion/sequence/io/out.hpp>
12 #include <boost/fusion/sequence/comparison/equal_to.hpp>
13 #include <boost/fusion/sequence/intrinsic/at.hpp>
14 #include <boost/fusion/container/generation/make_vector.hpp>
15 #include <boost/fusion/algorithm/transformation/replace_if.hpp>
16 #include <string>
17
18 struct gt3
19 {
20 template <typename T>
operator ()gt321 bool operator()(T x) const
22 {
23 return x > 3;
24 }
25 };
26
27 int
main()28 main()
29 {
30 using namespace boost::fusion;
31
32 std::cout << tuple_open('[');
33 std::cout << tuple_close(']');
34 std::cout << tuple_delimiter(", ");
35
36 /// Testing replace
37
38 {
39 char const* s = "Ruby";
40 typedef vector<int, short, double, long, char const*, float> vector_type;
41 vector_type t1(1, 2, 3.3, 4, s, 5.5f);
42
43 {
44 std::cout << replace_if(t1, gt3(), -456) << std::endl;
45 BOOST_TEST((replace_if(t1, gt3(), -456)
46 == make_vector(1, 2, -456, -456, s, -456)));
47 }
48 }
49
50 return boost::report_errors();
51 }
52
53