From: paolo Date: Mon, 19 Mar 2007 16:58:54 +0000 (+0000) Subject: 2007-03-19 Paolo Carlini X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dc9d68065ada66ead0f824018f1ad7af56f4cdc;p=thirdparty%2Fgcc.git 2007-03-19 Paolo Carlini * include/tr1/tuple (get(_Tuple_impl<>&, get(const _Tuple_impl<>&): Rename as __get_helper. (get(tuple<>&, get(const tuple<>&)): Forward to the latter. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123063 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 300b720dbf4c..a01ad6762139 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2007-03-19 Paolo Carlini + + * include/tr1/tuple (get(_Tuple_impl<>&, get(const _Tuple_impl<>&): + Rename as __get_helper. + (get(tuple<>&, get(const tuple<>&)): Forward to the latter. + 2007-03-19 Benjamin Kosnik * docs/doxygen/user.cfg.in: Update for new includes, macros. diff --git a/libstdc++-v3/include/tr1/tuple b/libstdc++-v3/include/tr1/tuple index 4e1a2d42f581..7beef19481bb 100644 --- a/libstdc++-v3/include/tr1/tuple +++ b/libstdc++-v3/include/tr1/tuple @@ -269,22 +269,40 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1) template const int tuple_size >::value; - // Returns a const reference to the ith element of a tuple. - // Any const or non-const ref elements are returned with their original type. template inline typename __add_ref<_Head>::type - get(_Tuple_impl<__i, _Head, _Tail...>& __t) + __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) { return __t._M_head; } template inline typename __add_c_ref<_Head>::type - get(const _Tuple_impl<__i, _Head, _Tail...>& __t) + __get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t) { return __t._M_head; } + // Return a reference (const reference) to the ith element of a tuple. + // Any const or non-const ref elements are returned with their original type. + template + inline typename __add_ref< + typename tuple_element<__i, tuple<_Elements...> >::type + >::type + get(tuple<_Elements...>& __t) + { + return __get_helper<__i>(__t); + } + + template + inline typename __add_c_ref< + typename tuple_element<__i, tuple<_Elements...> >::type + >::type + get(const tuple<_Elements...>& __t) + { + return __get_helper<__i>(__t); + } + // This class helps construct the various comparison operations on tuples template