Add safe iterator iterator_concept

Message ID 80417bb6-4a9b-faf0-b966-35649dfe114a@gmail.com
State New
Headers show
Series
  • Add safe iterator iterator_concept
Related show

Commit Message

François Dumont Nov. 25, 2019, 9:25 p.m.
I plan to commit this patch tomorrow.

     * include/debug/safe_iterator.h
[__cpp_lib_concepts](_Safe_iterator<>::iterator_concept): Define for
     C++20.

François

Comments

Jonathan Wakely Nov. 25, 2019, 9:36 p.m. | #1
On 25/11/19 22:25 +0100, François Dumont wrote:
>I plan to commit this patch tomorrow.

>

>    * include/debug/safe_iterator.h

>[__cpp_lib_concepts](_Safe_iterator<>::iterator_concept): Define for

>    C++20.


Thanks.

>François

>


>diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h

>index 685256551d9..abf575186c7 100644

>--- a/libstdc++-v3/include/debug/safe_iterator.h

>+++ b/libstdc++-v3/include/debug/safe_iterator.h

>@@ -141,6 +141,10 @@ namespace __gnu_debug

>       typedef typename _Traits::reference		reference;

>       typedef typename _Traits::pointer			pointer;

> 

>+#if __cplusplus > 201703L && __cpp_lib_concepts

>+      using iterator_concept = std::__detail::__iter_concept<_Iterator>;

>+#endif

>+

>       /// @post the iterator is singular and unattached

>       _Safe_iterator() _GLIBCXX_NOEXCEPT : _Iter_base() { }

>

Patch

diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h
index 685256551d9..abf575186c7 100644
--- a/libstdc++-v3/include/debug/safe_iterator.h
+++ b/libstdc++-v3/include/debug/safe_iterator.h
@@ -141,6 +141,10 @@  namespace __gnu_debug
       typedef typename _Traits::reference		reference;
       typedef typename _Traits::pointer			pointer;
 
+#if __cplusplus > 201703L && __cpp_lib_concepts
+      using iterator_concept = std::__detail::__iter_concept<_Iterator>;
+#endif
+
       /// @post the iterator is singular and unattached
       _Safe_iterator() _GLIBCXX_NOEXCEPT : _Iter_base() { }