From 103af3478e48a71906c14a811c84c7aa76b5a656 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 26 Feb 2014 01:56:31 +0000 Subject: [PATCH] Implement LWG issue 2306: match_results::reference should be value_type&, not const value_type&. This is a general move by the LWG to have the reference type of read-only containers be a non-const reference; however, there are no methods that return a non-const reference to a match_result entry, so there's no worries about getting a non-const reference to a constant object. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202214 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/regex | 4 ++-- test/re/re.results/types.pass.cpp | 2 +- www/cxx1y_status.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/regex b/include/regex index e121738a9..26ade48ba 100644 --- a/include/regex +++ b/include/regex @@ -437,7 +437,7 @@ class match_results public: typedef sub_match value_type; typedef const value_type& const_reference; - typedef const_reference reference; + typedef value_type& reference; typedef /implementation-defined/ const_iterator; typedef const_iterator iterator; typedef typename iterator_traits::difference_type difference_type; @@ -5263,7 +5263,7 @@ private: public: _BidirectionalIterator __position_start_; typedef const value_type& const_reference; - typedef const_reference reference; + typedef value_type& reference; typedef typename __container_type::const_iterator const_iterator; typedef const_iterator iterator; typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type; diff --git a/test/re/re.results/types.pass.cpp b/test/re/re.results/types.pass.cpp index 374815a70..4d553837e 100644 --- a/test/re/re.results/types.pass.cpp +++ b/test/re/re.results/types.pass.cpp @@ -35,7 +35,7 @@ test() typedef std::match_results MR; static_assert((std::is_same >::value), ""); static_assert((std::is_same& >::value), ""); - static_assert((std::is_same& >::value), ""); + static_assert((std::is_same& >::value), ""); static_assert((!std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); diff --git a/www/cxx1y_status.html b/www/cxx1y_status.html index 55451732a..827e3950d 100644 --- a/www/cxx1y_status.html +++ b/www/cxx1y_status.html @@ -242,7 +242,7 @@ 2293Wrong facet used by num_put::do_putIssaquahComplete 2301Why is std::tie not constexpr?IssaquahComplete 2304Complexity of count in unordered associative containersIssaquahComplete - 2306match_results::reference should be value_type&, not const value_type&Issaquah + 2306match_results::reference should be value_type&, not const value_type&IssaquahComplete 2308Clarify container destructor requirements w.r.t. std::arrayIssaquahComplete 2313tuple_size should always derive from integral_constantIssaquahComplete 2314apply() should return decltype(auto) and use decay_t before tuple_sizeIssaquah