This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3] PATCH: PR 20599 (variadic templates, take two) (4/4)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]