[v3] PATCH: PR 20599 (variadic templates, take two) (4/4)
Doug Gregor
doug.gregor@gmail.com
Tue Sep 19 17:05:00 GMT 2006
On 9/19/06, Chris Jefferson <chris@bubblescope.net> wrote:
> I have one very, very minor point. The TR1 standard requires the
> prototype for 'get' be:
>
> template <int I, class T1, class T2, ..., class TN>
> RJ get(tuple<T1, T2, ..., TN>& t);
>
> whereas the prototype used here is involved in a (very clever) trick
> to get an O(1) get. This could be fixed simply by wrapping get.
Thanks for taking a look. You're right, of course. If we rename the
current "get" to "__get_helper", the wrapper function looks like this:
template<int I, typename... Elements>
inline typename __add_ref<typename tuple_element<I,
tuple<Elements...> >::type>::__type
get(tuple<Elements...>& __t)
{
return __get_helper<I>(__t);
}
(similarly for const tuples).
Doug
More information about the Libstdc++
mailing list