
On 10/01/13 04:14, Daryle Walker wrote:
I'm talking about this: template < std::size_t ...N > struct indices_too { using next = indices_too<N..., sizeof...(N)>; }; template < std::size_t N > struct make_indices_too { using type = typename make_indices_too<N - 1u>::type::next; }; template < > struct make_indices_too<0u> { using type = indices_too<>; }; I've written things like this 4 times for my prototype Boost classes, and I want it in Boost already so I can just reference that version. Something like it will come in C++14, but we could provide it here for C++11 users? Do we already have one? Here's how to use one: template < typename Function, typename T, class Tuple, std::size_t ...I > void apply_x_and_exploded_tuple_impl( Function &&f, T &&x, Tuple &&t, indices_too<I...> ) { using std::forward; forward<Function>( f )( forward<T>(x), forward<typename std::tuple_element<I, typename std::remove_reference<Tuple>::type>::type>(std::get<I>( t ))... ); } template < typename Function, typename T, class Tuple > void apply_x_and_exploded_tuple( Function &&f, T &&x, Tuple &&t ) { using std::forward; apply_x_and_exploded_tuple_impl( forward<Function>(f), forward<T>(x), forward<Tuple>(t), typename make_indices_too<std::tuple_size<typename std::remove_reference<Tuple>::type>::value>::type{} ); } Daryle W.
Hi Daryle, I think package_c here: http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/mpl/package_... does that. And, package_range_c here: http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/mpl/package_... does, I'm guessing, something similar to make_indices_too, only it can do it either in reverse or forward order. And, unpack_args here: http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/mpl/unpack_a... does maybe something like apply_x_and_exploded_tuple_impl. So, I'd agree that these additions to boost would be useful. -regards, Larry