]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fusion/test/algorithm/for_each.cpp
1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
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/algorithm/iteration/for_each.hpp>
12 #include <boost/mpl/vector_c.hpp>
17 void operator()(T
const& v
) const
19 std::cout
<< "[ " << v
<< " ] ";
26 void operator()(T
& v
) const
35 using namespace boost::fusion
;
36 using boost::mpl::vector_c
;
37 namespace fusion
= boost::fusion
;
40 typedef vector
<int, char, double, char const*> vector_type
;
41 vector_type
v(1, 'x', 3.3, "Ruby");
43 std::cout
<< std::endl
;
47 typedef vector
<int, char, double, char const*> vector_type
;
48 vector_type
v(1, 'x', 3.3, "Ruby");
49 for_each(v
, increment());
50 std::cout
<< v
<< std::endl
;
54 typedef vector_c
<int, 2, 3, 4, 5, 6> mpl_vec
;
55 fusion::for_each(mpl_vec(), print());
56 std::cout
<< std::endl
;
59 return boost::report_errors();