]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fusion/test/algorithm/segmented_fold.cpp
1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3 Copyright (c) 2011 Eric Niebler
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
11 #include <boost/detail/lightweight_test.hpp>
12 #include <boost/fusion/container/vector/vector.hpp>
13 #include <boost/fusion/algorithm/iteration/fold.hpp>
14 #include <boost/fusion/container/generation/make_vector.hpp>
15 #include "../sequence/tree.hpp"
19 typedef std::ostream
* result_type
;
22 std::ostream
* operator()(std::ostream
* sout
, T
const& t
) const
24 return &(*sout
<< t
<< " ");
28 template<typename Tree
>
30 process_tree(Tree
const &tree
)
32 using namespace boost
;
34 std::stringstream str
;
35 fusion::fold(tree
, &str
, write_string());
36 std::string res
= str
.str();
38 BOOST_TEST_EQ(res
, "a b c 1 2 3 100 e f 0 B 1 h i 4 5 6 j k l ");
44 using namespace boost::fusion
;
47 make_vector(double(0),'B')
49 make_vector(1,2,long(3))
50 , make_tree(make_vector('a','b','c'))
51 , make_tree(make_vector(short('d'),'e','f'))
55 , make_tree(make_vector(float(1),'h','i'))
56 , make_tree(make_vector('j','k','l'))
61 return boost::report_errors();