diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-19 16:58:54 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-19 16:58:54 +0000 |
commit | 2dc9d68065ada66ead0f824018f1ad7af56f4cdc (patch) | |
tree | f1d8b028f549661907cef32d343d5c5dddd7b072 /libstdc++-v3 | |
parent | 021a18ba468547a170b8a19429fd940384bcf911 (diff) | |
download | gcc-2dc9d68065ada66ead0f824018f1ad7af56f4cdc.tar.gz |
2007-03-19 Paolo Carlini <pcarlini@suse.de>
* 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
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/tuple | 26 |
2 files changed, 28 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 300b720dbf4..a01ad676213 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2007-03-19 Paolo Carlini <pcarlini@suse.de> + + * 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 <bkoz@redhat.com> * 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 4e1a2d42f58..7beef19481b 100644 --- a/libstdc++-v3/include/tr1/tuple +++ b/libstdc++-v3/include/tr1/tuple @@ -269,22 +269,40 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1) template<typename... _Elements> const int tuple_size<tuple<_Elements...> >::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<int __i, typename _Head, typename... _Tail> 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<int __i, typename _Head, typename... _Tail> 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<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); + } + + template<int __i, typename... _Elements> + 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<int __check_equal_size, int __i, int __j, typename _Tp, typename _Up> |