Commit 3a004764 by Jonathan Wakely Committed by Jonathan Wakely

tuple (tuple_size<cv _Tp>): Implement LWG 2313.

	* include/std/tuple (tuple_size<cv _Tp>): Implement LWG 2313.
	* include/std/array (tuple_size, tuple_element): Add Doxygen comments.
	* include/std/utility (tuple_size, tuple_element): Likewise.
	* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
	Adjust dg-error line number.

From-SVN: r210470
parent ceed6e67
2014-05-15 Jonathan Wakely <jwakely@redhat.com>
* include/std/tuple (tuple_size<cv _Tp>): Implement LWG 2313.
* include/std/array (tuple_size, tuple_element): Add Doxygen comments.
* include/std/utility (tuple_size, tuple_element): Likewise.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Adjust dg-error line number.
2014-05-14 Jonathan Wakely <jwakely@redhat.com> 2014-05-14 Jonathan Wakely <jwakely@redhat.com>
* include/std/tuple (__add_c_ref, __add_ref, __add_r_ref): Remove. * include/std/tuple (__add_c_ref, __add_ref, __add_r_ref): Remove.
......
...@@ -306,6 +306,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -306,6 +306,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp> template<typename _Tp>
class tuple_size; class tuple_size;
/// Partial specialization for std::array
template<typename _Tp, std::size_t _Nm> template<typename _Tp, std::size_t _Nm>
struct tuple_size<_GLIBCXX_STD_C::array<_Tp, _Nm>> struct tuple_size<_GLIBCXX_STD_C::array<_Tp, _Nm>>
: public integral_constant<std::size_t, _Nm> { }; : public integral_constant<std::size_t, _Nm> { };
...@@ -314,6 +315,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -314,6 +315,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<std::size_t _Int, typename _Tp> template<std::size_t _Int, typename _Tp>
class tuple_element; class tuple_element;
/// Partial specialization for std::array
template<std::size_t _Int, typename _Tp, std::size_t _Nm> template<std::size_t _Int, typename _Tp, std::size_t _Nm>
struct tuple_element<_Int, _GLIBCXX_STD_C::array<_Tp, _Nm>> struct tuple_element<_Int, _GLIBCXX_STD_C::array<_Tp, _Nm>>
{ {
......
...@@ -693,18 +693,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -693,18 +693,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp> template<typename _Tp>
struct tuple_size; struct tuple_size;
template<typename _Tp, typename _Ts = tuple_size<_Tp>> // _GLIBCXX_RESOLVE_LIB_DEFECTS
using __cv_tuple_size = integral_constant< // 2313. tuple_size should always derive from integral_constant<size_t, N>
typename remove_cv<decltype(_Ts::value)>::type, _Ts::value>;
template<typename _Tp> template<typename _Tp>
struct tuple_size<const _Tp> : __cv_tuple_size<_Tp> { }; struct tuple_size<const _Tp>
: integral_constant<size_t, tuple_size<_Tp>::value> { };
template<typename _Tp> template<typename _Tp>
struct tuple_size<volatile _Tp> : __cv_tuple_size<_Tp> { }; struct tuple_size<volatile _Tp>
: integral_constant<size_t, tuple_size<_Tp>::value> { };
template<typename _Tp> template<typename _Tp>
struct tuple_size<const volatile _Tp> : __cv_tuple_size<_Tp> { }; struct tuple_size<const volatile _Tp>
: integral_constant<size_t, tuple_size<_Tp>::value> { };
/// class tuple_size /// class tuple_size
template<typename... _Elements> template<typename... _Elements>
......
...@@ -84,14 +84,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -84,14 +84,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class tuple_element; class tuple_element;
// Various functions which give std::pair a tuple-like interface. // Various functions which give std::pair a tuple-like interface.
/// Partial specialization for std::pair
template<class _Tp1, class _Tp2> template<class _Tp1, class _Tp2>
struct tuple_size<std::pair<_Tp1, _Tp2>> struct tuple_size<std::pair<_Tp1, _Tp2>>
: public integral_constant<std::size_t, 2> { }; : public integral_constant<std::size_t, 2> { };
/// Partial specialization for std::pair
template<class _Tp1, class _Tp2> template<class _Tp1, class _Tp2>
struct tuple_element<0, std::pair<_Tp1, _Tp2>> struct tuple_element<0, std::pair<_Tp1, _Tp2>>
{ typedef _Tp1 type; }; { typedef _Tp1 type; };
/// Partial specialization for std::pair
template<class _Tp1, class _Tp2> template<class _Tp1, class _Tp2>
struct tuple_element<1, std::pair<_Tp1, _Tp2>> struct tuple_element<1, std::pair<_Tp1, _Tp2>>
{ typedef _Tp2 type; }; { typedef _Tp2 type; };
......
...@@ -23,4 +23,4 @@ ...@@ -23,4 +23,4 @@
typedef std::tuple_element<1, std::array<int, 1>>::type type; typedef std::tuple_element<1, std::array<int, 1>>::type type;
// { dg-error "static assertion failed" "" { target *-*-* } 320 } // { dg-error "static assertion failed" "" { target *-*-* } 322 }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment