1 /*============================================================================= 2 Copyright (c) 2008 Dan Marsden 3 4 Use modification and distribution are subject to the Boost Software 5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 6 http://www.boost.org/LICENSE_1_0.txt). 7 ==============================================================================*/ 8 9 #include <boost/fusion/include/fold.hpp> 10 #include <boost/fusion/include/vector.hpp> 11 12 namespace fusion = boost::fusion; 13 14 namespace 15 { 16 template<int n, int batch> 17 struct distinct 18 {}; 19 20 struct f 21 { 22 typedef int result_type; 23 24 template<int n, int batch> operator ()__anonb22e10df0111::f25 int operator()(int state, distinct<n, batch> const& d) const 26 { 27 return state + n; 28 } 29 }; 30 31 template<int batch> test()32 void test() 33 { 34 fusion::vector< 35 distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>, 36 distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v; 37 38 fusion::fold(v, 0, f()); 39 } 40 } 41 42 #include "./driver.hpp" 43