
On 07/21/10 11:23, Peter Dimov wrote: [snip]
An interesting puzzle. I tried to apply the 'Indexes' technique shown in the bind implementation section of
http://osl.iu.edu/~dgregor/cpp/variadic-templates.pdf
and ended up with the following:
#include
#include template
struct int_tuple {}; // make indexes impl is a helper for make indexes template
struct make_indexes_impl; template
struct make_indexes_impl, T, Types...> { typedef typename make_indexes_impl, Types...>::type type; }; template
struct make_indexes_impl > { typedef int_tuple type; }; template
struct make_indexes: make_indexes_impl<0, int_tuple<>, Types...> { }; [snip] That make_indexes was the inspiration for:
http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/mpl/package_... One additional feature of package_range_c is the the order of the indexes can be reversed. Useful if you want to reverse the order of a mpl sequence. -regards, Larry