Ticket #10676: fold.cpp

File fold.cpp, 510 bytes (added by Jürgen Hunold, 8 years ago)

Test case

Line 
1#define BOOST_TEST_MAIN
2#include <boost/test/unit_test.hpp>
3
4#include <boost/fusion/container/vector.hpp>
5#include <boost/fusion/algorithm/iteration/fold.hpp>
6
7namespace
8{
9 struct functor
10 {
11 template<typename T>
12 int
13 operator() (int hitherho, T const& cur) const
14 {
15 return hitherho + cur;
16 }
17 };
18}
19
20BOOST_AUTO_TEST_CASE(fusion_test)
21{
22 boost::fusion::vector<int, double, long> container{1, 2, 3};
23 boost::fusion::fold(container, 0, functor{});
24}