From 6e556303102ebadb15bf8b7b16f6693d8ffde371 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Dumont?= Date: Sun, 6 Oct 2019 15:10:40 +0000 Subject: [PATCH] Add C++11 __iterator_category_t template alias. * include/bits/stl_iterator_base_types.h (__iterator_category_t): Define for C++11. (_RequireInputIte): Likewise and use __enable_if_t. * include/std/numeric (__is_random_access_iter): Use __iterator_category_t. From-SVN: r276637 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/bits/stl_iterator_base_types.h | 11 +++++++---- libstdc++-v3/include/std/numeric | 3 +-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5cb2e2924ee..40d9081a3c8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,11 @@ 2019-10-06 François Dumont + * include/bits/stl_iterator_base_types.h (__iterator_category_t): Define + for C++11. + (_RequireInputIte): Likewise and use __enable_if_t. + * include/std/numeric + (__is_random_access_iter): Use __iterator_category_t. + * include/bits/stl_algo.h (copy_n): Add __glibcxx_requires_can_increment debug checks. * testsuite/25_algorithms/copy_n/debug/1_neg.cc: New. diff --git a/libstdc++-v3/include/bits/stl_iterator_base_types.h b/libstdc++-v3/include/bits/stl_iterator_base_types.h index af69dbb017a..951e704e468 100644 --- a/libstdc++-v3/include/bits/stl_iterator_base_types.h +++ b/libstdc++-v3/include/bits/stl_iterator_base_types.h @@ -208,11 +208,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION //@} #if __cplusplus >= 201103L + template + using __iterator_category_t + = typename iterator_traits<_Iter>::iterator_category; + template - using _RequireInputIter = typename - enable_if::iterator_category, - input_iterator_tag>::value>::type; + using _RequireInputIter = + __enable_if_t, + input_iterator_tag>::value>; #endif _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric index 239276946b5..a164a9e6430 100644 --- a/libstdc++-v3/include/std/numeric +++ b/libstdc++-v3/include/std/numeric @@ -230,8 +230,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// @{ /// @cond undocumented - template, - typename _Cat = typename _Traits::iterator_category> + template> using __is_random_access_iter = is_base_of; /// @endcond -- 2.30.2