[PATCH, libstdc++] PR libstdc++/64656

Jonathan Wakely jwakely@redhat.com
Mon Jan 19 14:47:00 GMT 2015


On 19/01/15 02:48 +0200, Ville Voutilainen wrote:
>Minor additions:
>- add a comment to the #endif for the c++14 #if
>- fix the doc comments to talk about reverse iterators

Thanks, I like the new comments more.

>This passes the testsuite.

Posted during stage3 so OK for trunk.

>diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h
>index fa18aa2..a5a511c 100644
>--- a/libstdc++-v3/include/bits/range_access.h
>+++ b/libstdc++-v3/include/bits/range_access.h
>@@ -33,7 +33,7 @@
> #pragma GCC system_header
>
> #if __cplusplus >= 201103L
>-
>+#include <initializer_list>
> namespace std _GLIBCXX_VISIBILITY(default)
> {
> _GLIBCXX_BEGIN_NAMESPACE_VERSION
>@@ -97,6 +97,131 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>     end(_Tp (&__arr)[_Nm])
>     { return __arr + _Nm; }
>
>+#if __cplusplus >= 201402L
>+  /**
>+   *  @brief  Return an iterator pointing to the first element of
>+   *          the const container.
>+   *  @param  __cont  Container.
>+   */
>+  template<class _Container>
>+    inline constexpr auto

The 'inline' is redundant with 'constexpr' but harmless.

I notice we are missing the 'constexpr' that C++14 adds to the
existing begin/end functions for arrays, so I'm committing this
slightly changed version. I added _GLIBCXX14_CONSTEXPR to the
existing begin() and end() functions for arrays, and changed the new
test to use VERIFY instead of assert and to use the functions in
constant expressions.

Tested x86_64-linux and committed to trunk.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 7956 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150119/ea6db987/attachment.bin>


More information about the Gcc-patches mailing list