From: Jonathan Wakely Date: Thu, 15 May 2014 10:35:29 +0000 (+0100) Subject: tuple (tuple_size): Implement LWG 2313. X-Git-Tag: upstream/12.2.0~63272 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a004764ec49e9d14b1f4bd392caebf08e115598;p=platform%2Fupstream%2Fgcc.git tuple (tuple_size): Implement LWG 2313. * include/std/tuple (tuple_size): 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 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d6f2c23..fc2c582 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2014-05-15 Jonathan Wakely + + * include/std/tuple (tuple_size): 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 * include/std/tuple (__add_c_ref, __add_ref, __add_r_ref): Remove. diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index 22947ce..cc2c864 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -306,6 +306,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template class tuple_size; + /// Partial specialization for std::array template struct tuple_size<_GLIBCXX_STD_C::array<_Tp, _Nm>> : public integral_constant { }; @@ -314,6 +315,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template class tuple_element; + /// Partial specialization for std::array template struct tuple_element<_Int, _GLIBCXX_STD_C::array<_Tp, _Nm>> { diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 95c197d..ef8aa5a 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -693,18 +693,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct tuple_size; - template> - using __cv_tuple_size = integral_constant< - typename remove_cv::type, _Ts::value>; - + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2313. tuple_size should always derive from integral_constant template - struct tuple_size : __cv_tuple_size<_Tp> { }; + struct tuple_size + : integral_constant::value> { }; template - struct tuple_size : __cv_tuple_size<_Tp> { }; + struct tuple_size + : integral_constant::value> { }; template - struct tuple_size : __cv_tuple_size<_Tp> { }; + struct tuple_size + : integral_constant::value> { }; /// class tuple_size template diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index 4da9209..6d12839e 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -84,14 +84,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class tuple_element; // Various functions which give std::pair a tuple-like interface. + + /// Partial specialization for std::pair template struct tuple_size> : public integral_constant { }; + /// Partial specialization for std::pair template struct tuple_element<0, std::pair<_Tp1, _Tp2>> { typedef _Tp1 type; }; + /// Partial specialization for std::pair template struct tuple_element<1, std::pair<_Tp1, _Tp2>> { typedef _Tp2 type; }; diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc index f80798c..4b1e5ae 100644 --- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc @@ -23,4 +23,4 @@ typedef std::tuple_element<1, std::array>::type type; -// { dg-error "static assertion failed" "" { target *-*-* } 320 } +// { dg-error "static assertion failed" "" { target *-*-* } 322 }