1 2 // Copyright Aleksey Gurtovoy 2002-2004 3 // 4 // Distributed under the Boost Software License, Version 1.0. 5 // (See accompanying file LICENSE_1_0.txt or copy at 6 // http://www.boost.org/LICENSE_1_0.txt) 7 // 8 // See http://www.boost.org/libs/mpl for documentation. 9 10 // $Id$ 11 // $Date$ 12 // $Revision$ 13 14 #include <boost/mpl/reverse_fold.hpp> 15 #include <boost/mpl/list.hpp> 16 #include <boost/tuple/tuple.hpp> 17 18 #include <iostream> 19 20 using namespace boost::mpl; 21 22 template< typename Types > struct tuple_gen 23 : reverse_fold< 24 Types 25 , boost::tuples::null_type 26 , boost::tuples::cons<_2,_1> 27 > 28 { 29 }; 30 main()31int main() 32 { 33 tuple_gen< list<int,char const*,bool> >::type t; 34 35 boost::get<0>(t) = -1; 36 boost::get<1>(t) = "text"; 37 boost::get<2>(t) = false; 38 39 std::cout 40 << boost::get<0>(t) << '\n' 41 << boost::get<1>(t) << '\n' 42 << boost::get<2>(t) << '\n' 43 ; 44 45 return 0; 46 } 47