https://gcc.gnu.org/g:ae54d8cb51eb5cc1f5a3d319cc1840d2e9bfcbfc
commit r15-9380-gae54d8cb51eb5cc1f5a3d319cc1840d2e9bfcbfc Author: Tomasz Kamiński <tkami...@redhat.com> Date: Fri Mar 21 12:55:48 2025 +0100 libstdc++: Define __cpp_lib_containers_ranges in appropriate headers [PR111055] This is final piece of P1206R7, adding a feature test macros, as range constructors and member operations are now implemented for all containers and adaptors. For consistency with the proposal, all new container operations and helpers are now defined if __glibcxx_containers_ranges, instead of __glibcxx_ranges_to_container. PR libstdc++/111055 libstdc++-v3/ChangeLog: * include/bits/version.def (containers_ranges): Define. * include/bits/version.h: Regenerate. * include/bits/ranges_base.h (__detail::__container_compatible_range) (__detail::__range_to_alloc_type, __detail::__range_mapped_type) (__detail::__range_key_type): Depend on __glibcxx_containers_ranges instead of __glibcxx_ranges_to_container. * include/bits/basic_string.h: Replace __glibcxx_ranges_to_container with __glibcxx_containers_ranges. * include/bits/cow_string.h: Likewise. * include/bits/deque.tcc: Likewise. * include/bits/forward_list.h: Likewise. * include/bits/stl_bvector.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_queue.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_stack.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/vector.tcc: Likewise. * include/debug/deque: Likewise. * include/debug/forward_list: Likewise. * include/debug/list: Likewise. * include/debug/map.h: Likewise. * include/debug/multimap.h: Likewise. * include/debug/multiset.h: Likewise. * include/debug/set.h: Likewise. * include/debug/unordered_map: Likewise. * include/debug/unordered_set: Likewise. * include/debug/vector: Likewise. * include/std/deque: Provide __cpp_lib_containers_ranges. * include/std/forward_list: Likewise. * include/std/list: Likewise. * include/std/map: Likewise. * include/std/queue: Likewise. * include/std/set: Likewise. * include/std/stack: Likewise. * include/std/string: Likewise. * include/std/unordered_map: Likewise. * include/std/unordered_set: Likewise. * include/std/vector: Likewise. * testsuite/21_strings/basic_string/cons/from_range.cc: Test for value __cpp_lib_containers_ranges. * testsuite/23_containers/deque/cons/from_range.cc: Likewise. * testsuite/23_containers/forward_list/cons/from_range.cc: Likewise. * testsuite/23_containers/list/cons/from_range.cc: Likewise. * testsuite/23_containers/map/cons/from_range.cc: Likewise. * testsuite/23_containers/multimap/cons/from_range.cc: Likewise. * testsuite/23_containers/multiset/cons/from_range.cc: Likewise. * testsuite/23_containers/priority_queue/cons_from_range.cc: Likewise. * testsuite/23_containers/queue/cons_from_range.cc: Likewise. * testsuite/23_containers/set/cons/from_range.cc: Likewise. * testsuite/23_containers/stack/cons_from_range.cc: Likewise. * testsuite/23_containers/unordered_map/cons/from_range.cc: Likewise. * testsuite/23_containers/unordered_multimap/cons/from_range.cc: Likewise. * testsuite/23_containers/unordered_multiset/cons/from_range.cc: Likewise. * testsuite/23_containers/unordered_set/cons/from_range.cc: Likewise. * testsuite/23_containers/vector/bool/cons/from_range.cc: Likewise. * testsuite/23_containers/vector/cons/from_range.cc: Likewise. Reviewed-by: Jonathan Wakely <jwak...@redhat.com> Signed-off-by: Tomasz Kamiński <tkami...@redhat.com> Diff: --- libstdc++-v3/include/bits/basic_string.h | 16 ++++++++-------- libstdc++-v3/include/bits/cow_string.h | 10 +++++----- libstdc++-v3/include/bits/deque.tcc | 4 ++-- libstdc++-v3/include/bits/forward_list.h | 20 ++++++++++---------- libstdc++-v3/include/bits/ranges_base.h | 4 +++- libstdc++-v3/include/bits/stl_bvector.h | 8 ++++---- libstdc++-v3/include/bits/stl_deque.h | 12 ++++++------ libstdc++-v3/include/bits/stl_list.h | 12 ++++++------ libstdc++-v3/include/bits/stl_map.h | 8 ++++---- libstdc++-v3/include/bits/stl_multimap.h | 8 ++++---- libstdc++-v3/include/bits/stl_multiset.h | 8 ++++---- libstdc++-v3/include/bits/stl_queue.h | 14 +++++++------- libstdc++-v3/include/bits/stl_set.h | 8 ++++---- libstdc++-v3/include/bits/stl_stack.h | 8 ++++---- libstdc++-v3/include/bits/stl_vector.h | 16 ++++++++-------- libstdc++-v3/include/bits/unordered_map.h | 14 +++++++------- libstdc++-v3/include/bits/unordered_set.h | 14 +++++++------- libstdc++-v3/include/bits/vector.tcc | 4 ++-- libstdc++-v3/include/bits/version.def | 16 ++++++++-------- libstdc++-v3/include/bits/version.h | 10 ++++++++++ libstdc++-v3/include/debug/deque | 8 ++++---- libstdc++-v3/include/debug/forward_list | 10 +++++----- libstdc++-v3/include/debug/list | 10 +++++----- libstdc++-v3/include/debug/map.h | 4 ++-- libstdc++-v3/include/debug/multimap.h | 4 ++-- libstdc++-v3/include/debug/multiset.h | 4 ++-- libstdc++-v3/include/debug/set.h | 4 ++-- libstdc++-v3/include/debug/unordered_map | 8 ++++---- libstdc++-v3/include/debug/unordered_set | 8 ++++---- libstdc++-v3/include/debug/vector | 6 +++--- libstdc++-v3/include/std/deque | 1 + libstdc++-v3/include/std/forward_list | 1 + libstdc++-v3/include/std/list | 1 + libstdc++-v3/include/std/map | 1 + libstdc++-v3/include/std/queue | 1 + libstdc++-v3/include/std/set | 1 + libstdc++-v3/include/std/stack | 1 + libstdc++-v3/include/std/string | 1 + libstdc++-v3/include/std/unordered_map | 1 + libstdc++-v3/include/std/unordered_set | 1 + libstdc++-v3/include/std/vector | 1 + .../21_strings/basic_string/cons/from_range.cc | 5 +++++ .../testsuite/23_containers/deque/cons/from_range.cc | 5 +++++ .../23_containers/forward_list/cons/from_range.cc | 6 +++++- .../testsuite/23_containers/list/cons/from_range.cc | 5 +++++ .../testsuite/23_containers/map/cons/from_range.cc | 7 ++++++- .../23_containers/multimap/cons/from_range.cc | 7 ++++++- .../23_containers/multiset/cons/from_range.cc | 7 ++++++- .../23_containers/priority_queue/cons_from_range.cc | 7 ++++++- .../testsuite/23_containers/queue/cons_from_range.cc | 7 ++++++- .../testsuite/23_containers/set/cons/from_range.cc | 7 ++++++- .../testsuite/23_containers/stack/cons_from_range.cc | 7 ++++++- .../23_containers/unordered_map/cons/from_range.cc | 7 ++++++- .../unordered_multimap/cons/from_range.cc | 7 ++++++- .../unordered_multiset/cons/from_range.cc | 7 ++++++- .../23_containers/unordered_set/cons/from_range.cc | 7 ++++++- .../23_containers/vector/bool/cons/from_range.cc | 6 ++++++ .../23_containers/vector/cons/from_range.cc | 5 +++++ 58 files changed, 254 insertions(+), 146 deletions(-) diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 7670bace4793..630ff1af8d3f 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -51,7 +51,7 @@ # include <string_view> #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <bits/ranges_algobase.h> // ranges::copy # include <bits/ranges_util.h> // ranges::subrange #endif @@ -506,7 +506,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_NOEXCEPT { _S_copy(__p, __k1, __k2 - __k1); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 // pre: __n == ranges::distance(__rg). __p+[0,__n) is a valid range. template<typename _Rg> static constexpr void @@ -737,7 +737,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 __str._M_set_length(0); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a string from a range. * @since C++23 @@ -1573,7 +1573,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 append(size_type __n, _CharT __c) { return _M_replace_aux(this->size(), size_type(0), __n, __c); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Append a range to the string. * @param __rg A range of values that are convertible to `value_type`. @@ -1884,7 +1884,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { return this->replace(begin(), end(), __first, __last); } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Assign a range to the string. * @param __rg A range of values that are convertible to `value_type`. @@ -2052,7 +2052,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { this->replace(__p, __p, __beg, __end); } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Insert a range into the string. * @param __rg A range of values that are convertible to `value_type`. @@ -2671,7 +2671,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 __k1.base(), __k2 - __k1); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Replace part of the string with a range. * @param __rg A range of values that are convertible to `value_type`. @@ -3773,7 +3773,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 const _Allocator& = _Allocator()) -> basic_string<_CharT, _Traits, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, typename _Allocator = allocator<ranges::range_value_t<_Rg>>> basic_string(from_range_t, _Rg&&, _Allocator = _Allocator()) diff --git a/libstdc++-v3/include/bits/cow_string.h b/libstdc++-v3/include/bits/cow_string.h index 22a9814d2a8c..b250397151bb 100644 --- a/libstdc++-v3/include/bits/cow_string.h +++ b/libstdc++-v3/include/bits/cow_string.h @@ -639,7 +639,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a string from a range. * @since C++23 @@ -1349,7 +1349,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION basic_string& append(size_type __n, _CharT __c); -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Append a range to the string. * @since C++23 @@ -1536,7 +1536,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION assign(_InputIterator __first, _InputIterator __last) { return this->replace(_M_ibegin(), _M_iend(), __first, __last); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Set value to a range of characters. * @since C++23 @@ -1629,7 +1629,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION insert(iterator __p, _InputIterator __beg, _InputIterator __end) { this->replace(__p, __p, __beg, __end); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Insert a range into the string. * @since C++23 @@ -2166,7 +2166,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __k1.base(), __k2 - __k1); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Replace part of the string with a range. * @since C++23 diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc index 87ea1cebdaa3..dabb6ec53659 100644 --- a/libstdc++-v3/include/bits/deque.tcc +++ b/libstdc++-v3/include/bits/deque.tcc @@ -873,7 +873,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::forward_range _Rg> auto __advance_dist(_Rg& __rg) { @@ -1022,7 +1022,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER __guard.__n = size(); } } -#endif // ranges_to_container +#endif // containers_ranges template<typename _Tp, typename _Alloc> void diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h index 84882a57b3a6..8bcfb809319e 100644 --- a/libstdc++-v3/include/bits/forward_list.h +++ b/libstdc++-v3/include/bits/forward_list.h @@ -46,7 +46,7 @@ #include <ext/alloc_traits.h> #include <ext/aligned_buffer.h> #include <debug/assertions.h> -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <bits/ranges_base.h> // ranges::begin, ranges::distance etc. # include <bits/ranges_util.h> // ranges::subrange #endif @@ -896,7 +896,7 @@ namespace __fwdlist : _Base(_Node_alloc_type(__al)) { _M_range_initialize(__first, __last); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a forward_list from a range. * @param __rg An input range with elements that are convertible to @@ -918,7 +918,7 @@ namespace __fwdlist __to = __to->_M_next; } } -#endif // ranges_to_container +#endif // containers_ranges /** * @brief The %forward_list copy constructor. @@ -1071,7 +1071,7 @@ namespace __fwdlist } #pragma GCC diagnostic pop -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Assign a range to a forward_list. * @since C++23 @@ -1102,7 +1102,7 @@ namespace __fwdlist insert_range_after(__prev, ranges::subrange(std::move(__first), __last)); } -#endif // ranges_to_container +#endif // containers_ranges #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr @@ -1345,7 +1345,7 @@ namespace __fwdlist push_front(_Tp&& __val) { this->_M_insert_after(cbefore_begin(), std::move(__val)); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Insert a range at the beginning of a forward_list. * @param __rg An input range with elements that are convertible to @@ -1370,7 +1370,7 @@ namespace __fwdlist if (!__tmp.empty()) splice_after(before_begin(), __tmp); } -#endif // ranges_to_container +#endif // containers_ranges /** * @brief Removes first element. @@ -1491,7 +1491,7 @@ namespace __fwdlist insert_after(const_iterator __pos, std::initializer_list<_Tp> __il) { return insert_after(__pos, __il.begin(), __il.end()); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Insert a rangeinto a forward_list. * @param __position An iterator. @@ -1515,7 +1515,7 @@ namespace __fwdlist get_allocator()); return _M_splice_after(__position, __tmp.before_begin(), __tmp.end()); } -#endif // ranges_to_container +#endif // containers_ranges /** * @brief Removes the element pointed to by the iterator following @@ -1953,7 +1953,7 @@ namespace __fwdlist forward_list(_InputIterator, _InputIterator, _Allocator = _Allocator()) -> forward_list<_ValT, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, typename _Allocator = allocator<ranges::range_value_t<_Rg>>> forward_list(from_range_t, _Rg&&, _Allocator = _Allocator()) diff --git a/libstdc++-v3/include/bits/ranges_base.h b/libstdc++-v3/include/bits/ranges_base.h index 13bfbb3795bf..488907da4466 100644 --- a/libstdc++-v3/include/bits/ranges_base.h +++ b/libstdc++-v3/include/bits/ranges_base.h @@ -41,7 +41,7 @@ #include <bits/max_size_type.h> #include <bits/version.h> -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <bits/utility.h> // for tuple_element_t #endif @@ -1085,7 +1085,9 @@ namespace ranges #if __glibcxx_ranges_to_container // C++ >= 23 struct from_range_t { explicit from_range_t() = default; }; inline constexpr from_range_t from_range{}; +#endif +#if __glibcxx_containers_ranges // C++ >= 23 /// @cond undocumented template<typename _T1, typename _T2> struct pair; diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 03f6434604c3..8cc2920c629f 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -896,7 +896,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a vector from a range. * @param __rg A range of values that are convertible to `value_type`. @@ -1026,7 +1026,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { _M_assign_aux(__l.begin(), __l.end(), random_access_iterator_tag()); } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Assign a range to the vector. * @param __rg A range of values that are convertible to `value_type`. @@ -1347,7 +1347,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return this->insert(__p, __l.begin(), __l.end()); } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Insert a range into the vector. * @param __rg A range of values that are convertible to `bool`. @@ -1458,7 +1458,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(end(), __tmp.begin(), __tmp.end()); } } -#endif // ranges_to_container +#endif // containers_ranges _GLIBCXX20_CONSTEXPR void diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index 94e088610103..8d8ee575a26a 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -1022,7 +1022,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a deque from a range. * @param __rg A range of values that are convertible to `value_type`. @@ -1150,7 +1150,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { _M_assign_aux(__l.begin(), __l.end(), random_access_iterator_tag()); } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Assign a range to the deque. * @param __rg A range of values that are convertible to `value_type`. @@ -1194,7 +1194,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER emplace_back(*__first); } } -#endif // ranges_to_container +#endif // containers_ranges /// Get a copy of the memory allocation object. @@ -1824,7 +1824,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Insert a range into the deque. * @param __rg A range of values that are convertible to `value_type`. @@ -1854,7 +1854,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER template<__detail::__container_compatible_range<_Tp> _Rg> void append_range(_Rg&& __rg); -#endif // ranges_to_container +#endif // containers_ranges /** * @brief Remove element at given position. @@ -2386,7 +2386,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER deque(_InputIterator, _InputIterator, _Allocator = _Allocator()) -> deque<_ValT, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, typename _Alloc = allocator<ranges::range_value_t<_Rg>>> deque(from_range_t, _Rg&&, _Alloc = _Alloc()) diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index 82ccb50ff182..d27824c0a7af 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -66,7 +66,7 @@ #include <bits/ptr_traits.h> #include <ext/aligned_buffer.h> #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <bits/ranges_base.h> // ranges::begin, ranges::distance etc. # include <bits/ranges_util.h> // ranges::subrange #endif @@ -1263,7 +1263,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a list from a range. * @since C++23 @@ -1360,7 +1360,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Assign a range to a list. * @since C++23 @@ -1726,7 +1726,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Insert a range at the beginning of a list. * @param __rg An input range of elements that can be converted to @@ -1964,7 +1964,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Insert a range into a list. * @param __position An iterator. @@ -2594,7 +2594,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 list(_InputIterator, _InputIterator, _Allocator = _Allocator()) -> list<_ValT, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, typename _Allocator = allocator<ranges::range_value_t<_Rg>>> list(from_range_t, _Rg&&, _Allocator = _Allocator()) diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index 9381a7930af7..006ff46dfb5d 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -62,7 +62,7 @@ #include <initializer_list> #include <tuple> #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <bits/ranges_base.h> // ranges::begin, ranges::distance etc. #endif @@ -308,7 +308,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER : _M_t(__comp, _Pair_alloc_type(__a)) { _M_t._M_insert_range_unique(__first, __last); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Builds a %map from a range. * @since C++23 @@ -903,7 +903,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { insert(__list.begin(), __list.end()); } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Inserts a range of elements. * @since C++23 @@ -1536,7 +1536,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER map(initializer_list<pair<_Key, _Tp>>, _Allocator) -> map<_Key, _Tp, less<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Compare = less<__detail::__range_key_type<_Rg>>, __allocator_like _Alloc = diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index 8fca3a4275a4..4ee4a842b314 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -60,7 +60,7 @@ #if __cplusplus >= 201103L #include <initializer_list> #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <bits/ranges_base.h> // ranges::begin, ranges::distance etc. #endif @@ -297,7 +297,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER : _M_t(__comp, _Pair_alloc_type(__a)) { _M_t._M_insert_range_equal(__first, __last); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Builds a %multimap from a range. * @since C++23 @@ -655,7 +655,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { this->insert(__l.begin(), __l.end()); } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Inserts a range of elements. * @since C++23 @@ -1159,7 +1159,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER multimap(initializer_list<pair<_Key, _Tp>>, _Allocator) -> multimap<_Key, _Tp, less<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Compare = less<__detail::__range_key_type<_Rg>>, __allocator_like _Alloc = diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index 7030f286750d..31451abe58e7 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -60,7 +60,7 @@ #if __cplusplus >= 201103L #include <initializer_list> #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <bits/ranges_base.h> // ranges::begin, ranges::distance etc. #endif @@ -274,7 +274,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER : _M_t(_Key_alloc_type(__a)) { _M_t._M_insert_range_equal(__first, __last); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Builds a %multiset from a range. * @since C++23 @@ -588,7 +588,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { this->insert(__l.begin(), __l.end()); } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Inserts a range of elements. * @since C++23 @@ -996,7 +996,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER multiset(initializer_list<_Key>, _Allocator) -> multiset<_Key, less<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Compare = less<ranges::range_value_t<_Rg>>, __allocator_like _Alloc = std::allocator<ranges::range_value_t<_Rg>>> diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h index 2a4b62918a0a..554e076aae90 100644 --- a/libstdc++-v3/include/bits/stl_queue.h +++ b/libstdc++-v3/include/bits/stl_queue.h @@ -61,7 +61,7 @@ #if __cplusplus >= 201103L # include <bits/uses_allocator.h> #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <ranges> // ranges::to # include <bits/ranges_algobase.h> // ranges::copy #endif @@ -213,7 +213,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : c(__first, __last, __a) { } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a queue from a range. * @since C++23 @@ -326,7 +326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<_Tp> _Rg> void push_range(_Rg&& __rg) @@ -397,7 +397,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION -> queue<_ValT, deque<_ValT, _Allocator>>; #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg> queue(from_range_t, _Rg&&) -> queue<ranges::range_value_t<_Rg>>; @@ -766,7 +766,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a priority_queue from a range. * @since C++23 @@ -849,7 +849,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<_Tp> _Rg> void push_range(_Rg&& __rg) @@ -924,7 +924,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION priority_queue(_Compare, _Container, _Allocator) -> priority_queue<typename _Container::value_type, _Container, _Compare>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Compare = less<ranges::range_value_t<_Rg>>, __allocator_like _Alloc = std::allocator<ranges::range_value_t<_Rg>>> diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index 124237edf8ed..0799fd0918a3 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -60,7 +60,7 @@ #if __cplusplus >= 201103L #include <initializer_list> #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <bits/ranges_base.h> // ranges::begin, ranges::distance etc. #endif @@ -278,7 +278,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER : _M_t(_Key_alloc_type(__a)) { _M_t._M_insert_range_unique(__first, __last); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Builds a %set from a range. * @since C++23 @@ -603,7 +603,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { this->insert(__l.begin(), __l.end()); } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Inserts a range of elements. * @since C++23 @@ -1014,7 +1014,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER set(initializer_list<_Key>, _Allocator) -> set<_Key, less<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Compare = less<ranges::range_value_t<_Rg>>, __allocator_like _Alloc = std::allocator<ranges::range_value_t<_Rg>>> diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h index 2a274bf4c3af..7b324642b322 100644 --- a/libstdc++-v3/include/bits/stl_stack.h +++ b/libstdc++-v3/include/bits/stl_stack.h @@ -61,7 +61,7 @@ #if __cplusplus >= 201103L # include <bits/uses_allocator.h> #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <ranges> // ranges::to # include <bits/ranges_algobase.h> // ranges::copy #endif @@ -181,7 +181,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : c(__first, __last) { } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a stack from a range. * @since C++23 @@ -300,7 +300,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<_Tp> _Rg> void push_range(_Rg&& __rg) @@ -371,7 +371,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION -> stack<_ValT, deque<_ValT, _Allocator>>; #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg> stack(from_range_t, _Rg&&) -> stack<ranges::range_value_t<_Rg>>; diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 458adc987dac..aff9d5d9ca5b 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -68,7 +68,7 @@ #if __glibcxx_concepts // C++ >= C++20 # include <bits/ranges_base.h> // ranges::distance #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <bits/ranges_algobase.h> // ranges::copy # include <bits/ranges_util.h> // ranges::subrange #endif @@ -407,7 +407,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 // Called by insert_range, and indirectly by assign_range, append_range. // Initializes new elements in storage at __ptr and updates __ptr to // point after the last new element. @@ -763,7 +763,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a vector from a range. * @param __rg A range of values that are convertible to `bool`. @@ -926,7 +926,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Assign a range to the vector. * @param __rg A range of values that are convertible to `value_type`. @@ -982,7 +982,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } } } -#endif // ranges_to_container +#endif // containers_ranges /// Get a copy of the memory allocation object. using _Base::get_allocator; @@ -1648,7 +1648,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Insert a range into the vector. * @param __rg A range of values that are convertible to `value_type`. @@ -1769,7 +1769,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER append_range(__r); // This will take the fast path above. } } -#endif // ranges_to_container +#endif // containers_ranges /** * @brief Remove element at given position. @@ -2313,7 +2313,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER vector(_InputIterator, _InputIterator, _Allocator = _Allocator()) -> vector<_ValT, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, typename _Alloc = allocator<ranges::range_value_t<_Rg>>> vector(from_range_t, _Rg&&, _Alloc = _Alloc()) diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h index 49e97e2dfca9..5bc58e849ffa 100644 --- a/libstdc++-v3/include/bits/unordered_map.h +++ b/libstdc++-v3/include/bits/unordered_map.h @@ -34,7 +34,7 @@ #include <bits/allocator.h> #include <bits/functional_hash.h> // hash #include <bits/stl_function.h> // equal_to -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <bits/ranges_base.h> // ranges::begin, ranges::distance etc. #endif @@ -277,7 +277,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER : unordered_map(__l, __n, __hf, key_equal(), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Builds an %unordered_map from a range. * @since C++23 @@ -681,7 +681,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(initializer_list<value_type> __l) { _M_h.insert(__l); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Inserts a range of elements. * @since C++23 @@ -1291,7 +1291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _Hash, _Allocator) -> unordered_map<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Hash = hash<__detail::__range_key_type<_Rg>>, __not_allocator_like _Pred = equal_to<__detail::__range_key_type<_Rg>>, @@ -1530,7 +1530,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER : unordered_multimap(__l, __n, __hf, key_equal(), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Builds an %unordered_multimap from a range. * @since C++23 @@ -1802,7 +1802,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(initializer_list<value_type> __l) { _M_h.insert(__l); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Inserts a range of elements. * @since C++23 @@ -2311,7 +2311,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _Hash, _Allocator) -> unordered_multimap<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Hash = hash<__detail::__range_key_type<_Rg>>, __not_allocator_like _Pred = equal_to<__detail::__range_key_type<_Rg>>, diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h index 4bc256c17c1e..091bae60e555 100644 --- a/libstdc++-v3/include/bits/unordered_set.h +++ b/libstdc++-v3/include/bits/unordered_set.h @@ -34,7 +34,7 @@ #include <bits/allocator.h> #include <bits/functional_hash.h> // hash #include <bits/stl_function.h> // equal_to -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 # include <bits/ranges_base.h> // ranges::begin, ranges::distance etc. #endif @@ -271,7 +271,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER : unordered_set(__l, __n, __hf, key_equal(), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Builds an %unordered_set from a range. * @since C++23 @@ -533,7 +533,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(initializer_list<value_type> __l) { _M_h.insert(__l); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Inserts a range of elements. * @since C++23 @@ -1013,7 +1013,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER unordered_set<int>::size_type, _Hash, _Allocator) -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Hash = hash<ranges::range_value_t<_Rg>>, __not_allocator_like _Pred = equal_to<ranges::range_value_t<_Rg>>, @@ -1249,7 +1249,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER : unordered_multiset(__l, __n, __hf, key_equal(), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Builds an %unordered_multiset from a range. * @since C++23 @@ -1483,7 +1483,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(initializer_list<value_type> __l) { _M_h.insert(__l); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Inserts a range of elements. * @since C++23 @@ -1977,7 +1977,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER unordered_multiset<int>::size_type, _Hash, _Allocator) -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Hash = hash<ranges::range_value_t<_Rg>>, __not_allocator_like _Pred = equal_to<ranges::range_value_t<_Rg>>, diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc index 66d73b4cfd7e..b21e1d3b7a2c 100644 --- a/libstdc++-v3/include/bits/vector.tcc +++ b/libstdc++-v3/include/bits/vector.tcc @@ -977,7 +977,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<typename _Tp, typename _Alloc> template<__detail::__container_compatible_range<_Tp> _Rg> constexpr auto @@ -1100,7 +1100,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER return insert_range(__pos, vector(from_range, std::forward<_Rg>(__rg), _M_get_Tp_allocator())); } -#endif // ranges_to_container +#endif // containers_ranges // vector<bool> template<typename _Alloc> diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index 2ec1b40bd38f..0afaf0dec244 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -1515,14 +1515,14 @@ ftms = { }; }; -//ftms = { -// name = containers_ranges; -// values = { -// v = 202202; -// cxxmin = 23; -// hosted = yes; -// }; -//}; +ftms = { + name = containers_ranges; + values = { + v = 202202; + cxxmin = 23; + hosted = yes; + }; +}; ftms = { name = ranges_to_container; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 04c1349c84bb..980fee641e9d 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -1669,6 +1669,16 @@ #endif /* !defined(__cpp_lib_reference_from_temporary) && defined(__glibcxx_want_reference_from_temporary) */ #undef __glibcxx_want_reference_from_temporary +#if !defined(__cpp_lib_containers_ranges) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_containers_ranges 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_containers_ranges) +# define __cpp_lib_containers_ranges 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_containers_ranges) && defined(__glibcxx_want_containers_ranges) */ +#undef __glibcxx_want_containers_ranges + #if !defined(__cpp_lib_ranges_to_container) # if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED # define __glibcxx_ranges_to_container 202202L diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque index 9715721ca521..59d60b2120db 100644 --- a/libstdc++-v3/include/debug/deque +++ b/libstdc++-v3/include/debug/deque @@ -155,7 +155,7 @@ namespace __debug __gnu_debug::__base(__last), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<_Tp> _Rg> deque(from_range_t, _Rg&& __rg, const _Allocator& __a = _Allocator()) : _Base(from_range, std::forward<_Rg>(__rg), __a) @@ -217,7 +217,7 @@ namespace __debug } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<std::__detail::__container_compatible_range<_Tp> _Rg> void assign_range(_Rg&& __rg) @@ -561,7 +561,7 @@ namespace __debug } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<_Tp> _Rg> iterator insert_range(const_iterator __pos, _Rg&& __rg) @@ -712,7 +712,7 @@ namespace __debug deque(size_t, _Tp, _Allocator = _Allocator()) -> deque<_Tp, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, typename _Alloc = allocator<ranges::range_value_t<_Rg>>> deque(from_range_t, _Rg&&, _Alloc = _Alloc()) diff --git a/libstdc++-v3/include/debug/forward_list b/libstdc++-v3/include/debug/forward_list index 00b96d6fae48..60a254297d54 100644 --- a/libstdc++-v3/include/debug/forward_list +++ b/libstdc++-v3/include/debug/forward_list @@ -267,7 +267,7 @@ namespace __debug __gnu_debug::__base(__last), __al) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<_Tp> _Rg> forward_list(from_range_t, _Rg&& __rg, const _Alloc& __a = _Alloc()) : _Base(std::from_range, std::forward<_Rg>(__rg), __a) @@ -318,7 +318,7 @@ namespace __debug this->_M_invalidate_all(); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<_Tp> _Rg> void assign_range(_Rg&& __rg) @@ -440,7 +440,7 @@ namespace __debug using _Base::emplace_front; using _Base::push_front; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 using _Base::prepend_range; #endif @@ -512,7 +512,7 @@ namespace __debug return { _Base::insert_after(__pos.base(), __il), this }; } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<_Tp> _Rg> iterator insert_range_after(const_iterator __position, _Rg&& __rg) @@ -917,7 +917,7 @@ namespace __debug forward_list(size_t, _Tp, _Allocator = _Allocator()) -> forward_list<_Tp, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, typename _Allocator = allocator<ranges::range_value_t<_Rg>>> forward_list(from_range_t, _Rg&&, _Allocator = _Allocator()) diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list index 344fc98c05fc..a9d974c40a5d 100644 --- a/libstdc++-v3/include/debug/list +++ b/libstdc++-v3/include/debug/list @@ -160,7 +160,7 @@ namespace __debug __gnu_debug::__base(__last), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<_Tp> _Rg> list(from_range_t, _Rg&& __rg, const _Allocator& __a = _Allocator()) : _Base(std::from_range, std::forward<_Rg>(__rg), __a) @@ -214,7 +214,7 @@ namespace __debug this->_M_invalidate_all(); } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<_Tp> _Rg> void assign_range(_Rg&& __rg) @@ -434,7 +434,7 @@ namespace __debug using _Base::emplace_front; #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 using _Base::prepend_range; using _Base::append_range; #endif @@ -549,7 +549,7 @@ namespace __debug } #endif -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<_Tp> _Rg> iterator insert_range(const_iterator __position, _Rg&& __rg) @@ -970,7 +970,7 @@ namespace __debug list(size_t, _Tp, _Allocator = _Allocator()) -> list<_Tp, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, typename _Allocator = allocator<ranges::range_value_t<_Rg>>> list(from_range_t, _Rg&&, _Allocator = _Allocator()) diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h index aa1c1dbd47aa..985a7ac86d3c 100644 --- a/libstdc++-v3/include/debug/map.h +++ b/libstdc++-v3/include/debug/map.h @@ -133,7 +133,7 @@ namespace __debug __gnu_debug::__base(__last), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a map from a range. * @since C++23 @@ -759,7 +759,7 @@ namespace __debug map(initializer_list<pair<_Key, _Tp>>, _Allocator) -> map<_Key, _Tp, less<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Compare = less<__detail::__range_key_type<_Rg>>, __allocator_like _Alloc = diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h index bef1f174a8e0..c187e5191b1b 100644 --- a/libstdc++-v3/include/debug/multimap.h +++ b/libstdc++-v3/include/debug/multimap.h @@ -133,7 +133,7 @@ namespace __debug __glibcxx_check_valid_constructor_range(__first, __last)), __gnu_debug::__base(__last), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a multimap from a range. * @since C++23 @@ -641,7 +641,7 @@ namespace __debug multimap(initializer_list<pair<_Key, _Tp>>, _Allocator) -> multimap<_Key, _Tp, less<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Compare = less<__detail::__range_key_type<_Rg>>, __allocator_like _Alloc = diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h index bddcd282bfa2..41bf78d04b2a 100644 --- a/libstdc++-v3/include/debug/multiset.h +++ b/libstdc++-v3/include/debug/multiset.h @@ -133,7 +133,7 @@ namespace __debug __glibcxx_check_valid_constructor_range(__first, __last)), __gnu_debug::__base(__last), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a multiset from a range. * @since C++23 @@ -613,7 +613,7 @@ namespace __debug multiset(initializer_list<_Key>, _Allocator) -> multiset<_Key, less<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Compare = less<ranges::range_value_t<_Rg>>, __allocator_like _Alloc = std::allocator<ranges::range_value_t<_Rg>>> diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h index 9555555975f0..6ec833821678 100644 --- a/libstdc++-v3/include/debug/set.h +++ b/libstdc++-v3/include/debug/set.h @@ -131,7 +131,7 @@ namespace __debug __glibcxx_check_valid_constructor_range(__first, __last)), __gnu_debug::__base(__last), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a set from a range. * @since C++23 @@ -623,7 +623,7 @@ namespace __debug set(initializer_list<_Key>, _Allocator) -> set<_Key, less<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Compare = less<ranges::range_value_t<_Rg>>, __allocator_like _Alloc = std::allocator<ranges::range_value_t<_Rg>>> diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map index 16d4a4a98e0d..448f681e16b2 100644 --- a/libstdc++-v3/include/debug/unordered_map +++ b/libstdc++-v3/include/debug/unordered_map @@ -201,7 +201,7 @@ namespace __debug : unordered_map(__l, __n, __hf, key_equal(), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<value_type> _Rg> unordered_map(from_range_t, _Rg&& __rg, size_type __n = 0, @@ -869,7 +869,7 @@ namespace __debug _Hash, _Allocator) -> unordered_map<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Hash = hash<__detail::__range_key_type<_Rg>>, __not_allocator_like _Pred = equal_to<__detail::__range_key_type<_Rg>>, @@ -1077,7 +1077,7 @@ namespace __debug : unordered_multimap(__l, __n, __hf, key_equal(), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<value_type> _Rg> unordered_multimap(from_range_t, _Rg&& __rg, size_type __n = 0, @@ -1655,7 +1655,7 @@ namespace __debug _Hash, _Allocator) -> unordered_multimap<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Hash = hash<__detail::__range_key_type<_Rg>>, __not_allocator_like _Pred = equal_to<__detail::__range_key_type<_Rg>>, diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set index 2e342ccbd978..4255f6ee7700 100644 --- a/libstdc++-v3/include/debug/unordered_set +++ b/libstdc++-v3/include/debug/unordered_set @@ -194,7 +194,7 @@ namespace __debug : unordered_set(__l, __n, __hf, key_equal(), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<value_type> _Rg> unordered_set(from_range_t, _Rg&& __rg, size_type __n = 0, @@ -902,7 +902,7 @@ namespace __debug : unordered_multiset(__l, __n, __hf, key_equal(), __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<__detail::__container_compatible_range<value_type> _Rg> unordered_multiset(from_range_t, _Rg&& __rg, size_type __n = 0, @@ -1444,7 +1444,7 @@ namespace __debug unordered_multiset<int>::size_type, _Hash, _Allocator) -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Hash = hash<ranges::range_value_t<_Rg>>, __not_allocator_like _Pred = equal_to<ranges::range_value_t<_Rg>>, @@ -1479,7 +1479,7 @@ namespace __debug equal_to<ranges::range_value_t<_Rg>>, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, __not_allocator_like _Hash = hash<ranges::range_value_t<_Rg>>, __not_allocator_like _Pred = equal_to<ranges::range_value_t<_Rg>>, diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector index b49766c18a76..1b3486b0dc08 100644 --- a/libstdc++-v3/include/debug/vector +++ b/libstdc++-v3/include/debug/vector @@ -244,7 +244,7 @@ namespace __debug const allocator_type& __a = allocator_type()) : _Base(__l, __a) { } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 /** * @brief Construct a vector from a range. * @since C++23 @@ -871,7 +871,7 @@ namespace __debug const _Base& _M_base() const _GLIBCXX_NOEXCEPT { return *this; } -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<std::__detail::__container_compatible_range<_Tp> _Rg> constexpr void assign_range(_Rg&& __rg) @@ -999,7 +999,7 @@ namespace __debug vector(size_t, _Tp, _Allocator = _Allocator()) -> vector<_Tp, _Allocator>; -#if __glibcxx_ranges_to_container // C++ >= 23 +#if __glibcxx_containers_ranges // C++ >= 23 template<ranges::input_range _Rg, typename _Alloc = allocator<ranges::range_value_t<_Rg>>> vector(from_range_t, _Rg&&, _Alloc = _Alloc()) diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque index 8fd7300f2de1..2badab80a6dc 100644 --- a/libstdc++-v3/include/std/deque +++ b/libstdc++-v3/include/std/deque @@ -72,6 +72,7 @@ #define __glibcxx_want_algorithm_default_value_type #define __glibcxx_want_allocator_traits_is_always_equal +#define __glibcxx_want_containers_ranges #define __glibcxx_want_erase_if #define __glibcxx_want_nonmember_container_access #include <bits/version.h> diff --git a/libstdc++-v3/include/std/forward_list b/libstdc++-v3/include/std/forward_list index 166fdb04242a..d478851acf9f 100644 --- a/libstdc++-v3/include/std/forward_list +++ b/libstdc++-v3/include/std/forward_list @@ -49,6 +49,7 @@ #define __glibcxx_want_algorithm_default_value_type #define __glibcxx_want_allocator_traits_is_always_equal +#define __glibcxx_want_containers_ranges #define __glibcxx_want_erase_if #define __glibcxx_want_incomplete_container_elements #define __glibcxx_want_list_remove_return_type diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list index 170499d65f71..2ba0599d33df 100644 --- a/libstdc++-v3/include/std/list +++ b/libstdc++-v3/include/std/list @@ -73,6 +73,7 @@ #define __glibcxx_want_algorithm_default_value_type #define __glibcxx_want_allocator_traits_is_always_equal +#define __glibcxx_want_containers_ranges #define __glibcxx_want_erase_if #define __glibcxx_want_incomplete_container_elements #define __glibcxx_want_list_remove_return_type diff --git a/libstdc++-v3/include/std/map b/libstdc++-v3/include/std/map index 16a397fceccd..6bfb53848ba0 100644 --- a/libstdc++-v3/include/std/map +++ b/libstdc++-v3/include/std/map @@ -72,6 +72,7 @@ #endif #define __glibcxx_want_allocator_traits_is_always_equal +#define __glibcxx_want_containers_ranges #define __glibcxx_want_erase_if #define __glibcxx_want_generic_associative_lookup #define __glibcxx_want_map_try_emplace diff --git a/libstdc++-v3/include/std/queue b/libstdc++-v3/include/std/queue index c06a4c370900..74b6c07b49f1 100644 --- a/libstdc++-v3/include/std/queue +++ b/libstdc++-v3/include/std/queue @@ -68,6 +68,7 @@ #include <bits/stl_queue.h> #define __glibcxx_want_adaptor_iterator_pair_constructor +#define __glibcxx_want_containers_ranges #include <bits/version.h> #endif /* _GLIBCXX_QUEUE */ diff --git a/libstdc++-v3/include/std/set b/libstdc++-v3/include/std/set index 2ebf485ce559..cf7057aa6c63 100644 --- a/libstdc++-v3/include/std/set +++ b/libstdc++-v3/include/std/set @@ -72,6 +72,7 @@ #endif #define __glibcxx_want_allocator_traits_is_always_equal +#define __glibcxx_want_containers_ranges #define __glibcxx_want_erase_if #define __glibcxx_want_generic_associative_lookup #define __glibcxx_want_node_extract diff --git a/libstdc++-v3/include/std/stack b/libstdc++-v3/include/std/stack index 2f7951a6fbca..5cea4762a192 100644 --- a/libstdc++-v3/include/std/stack +++ b/libstdc++-v3/include/std/stack @@ -65,6 +65,7 @@ #include <bits/stl_stack.h> #define __glibcxx_want_adaptor_iterator_pair_constructor +#define __glibcxx_want_containers_ranges #include <bits/version.h> #endif /* _GLIBCXX_STACK */ diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string index 6211da9a7bcd..71864715ff75 100644 --- a/libstdc++-v3/include/std/string +++ b/libstdc++-v3/include/std/string @@ -60,6 +60,7 @@ #define __glibcxx_want_allocator_traits_is_always_equal #define __glibcxx_want_constexpr_char_traits #define __glibcxx_want_constexpr_string +#define __glibcxx_want_containers_ranges #define __glibcxx_want_erase_if #define __glibcxx_want_nonmember_container_access #define __glibcxx_want_string_resize_and_overwrite diff --git a/libstdc++-v3/include/std/unordered_map b/libstdc++-v3/include/std/unordered_map index 37f227368da3..3ae25d758ace 100644 --- a/libstdc++-v3/include/std/unordered_map +++ b/libstdc++-v3/include/std/unordered_map @@ -49,6 +49,7 @@ #endif #define __glibcxx_want_allocator_traits_is_always_equal +#define __glibcxx_want_containers_ranges #define __glibcxx_want_erase_if #define __glibcxx_want_generic_unordered_lookup #define __glibcxx_want_node_extract diff --git a/libstdc++-v3/include/std/unordered_set b/libstdc++-v3/include/std/unordered_set index 4c73e5d7875a..b561163d31d2 100644 --- a/libstdc++-v3/include/std/unordered_set +++ b/libstdc++-v3/include/std/unordered_set @@ -49,6 +49,7 @@ #endif #define __glibcxx_want_allocator_traits_is_always_equal +#define __glibcxx_want_containers_ranges #define __glibcxx_want_erase_if #define __glibcxx_want_generic_unordered_lookup #define __glibcxx_want_node_extract diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector index 8bb2543d9afe..a98ffb179ec0 100644 --- a/libstdc++-v3/include/std/vector +++ b/libstdc++-v3/include/std/vector @@ -81,6 +81,7 @@ #define __glibcxx_want_algorithm_default_value_type #define __glibcxx_want_allocator_traits_is_always_equal #define __glibcxx_want_constexpr_vector +#define __glibcxx_want_containers_ranges #define __glibcxx_want_erase_if #define __glibcxx_want_incomplete_container_elements #define __glibcxx_want_nonmember_container_access diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/from_range.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/from_range.cc index 0795cb41ee96..6331050309ce 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/from_range.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/from_range.cc @@ -1,6 +1,11 @@ // { dg-do run { target c++23 } } #include <string> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <string>" +#endif + #include <span> #include <testsuite_hooks.h> #include <testsuite_iterators.h> diff --git a/libstdc++-v3/testsuite/23_containers/deque/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/deque/cons/from_range.cc index 96e994d649c1..48fd1965f9a5 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/cons/from_range.cc @@ -1,6 +1,11 @@ // { dg-do run { target c++23 } } #include <deque> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <deque>" +#endif + #include <span> #include <testsuite_hooks.h> #include <testsuite_iterators.h> diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/from_range.cc index 65b378e69773..aa7010531f57 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/from_range.cc @@ -1,11 +1,15 @@ // { dg-do run { target c++23 } } #include <forward_list> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <forward_list>" +#endif + #include <span> #include <testsuite_hooks.h> #include <testsuite_iterators.h> #include <testsuite_allocator.h> - void test_deduction_guide(long* p) { diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/list/cons/from_range.cc index 31448b9122b4..107ad7477ce4 100644 --- a/libstdc++-v3/testsuite/23_containers/list/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/list/cons/from_range.cc @@ -1,6 +1,11 @@ // { dg-do run { target c++23 } } #include <list> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <list>" +#endif + #include <span> #include <testsuite_hooks.h> #include <testsuite_iterators.h> diff --git a/libstdc++-v3/testsuite/23_containers/map/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/map/cons/from_range.cc index c740471f2da1..9935f44aa0f9 100644 --- a/libstdc++-v3/testsuite/23_containers/map/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/map/cons/from_range.cc @@ -1,7 +1,12 @@ // { dg-do run { target c++23 } } -#include <algorithm> #include <map> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <map>" +#endif + +#include <algorithm> #include <ranges> #include <span> #include <testsuite_allocator.h> diff --git a/libstdc++-v3/testsuite/23_containers/multimap/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/multimap/cons/from_range.cc index 3e456f566ccc..4a8ea9fec7d7 100644 --- a/libstdc++-v3/testsuite/23_containers/multimap/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/multimap/cons/from_range.cc @@ -1,7 +1,12 @@ // { dg-do run { target c++23 } } -#include <algorithm> #include <map> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <map>" +#endif + +#include <algorithm> #include <ranges> #include <span> #include <testsuite_allocator.h> diff --git a/libstdc++-v3/testsuite/23_containers/multiset/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/multiset/cons/from_range.cc index 43821ca556ac..cdba7eb2d632 100644 --- a/libstdc++-v3/testsuite/23_containers/multiset/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/multiset/cons/from_range.cc @@ -1,8 +1,13 @@ // { dg-do run { target c++23 } } +#include <set> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <set>" +#endif + #include <algorithm> #include <ranges> -#include <set> #include <span> #include <testsuite_allocator.h> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/23_containers/priority_queue/cons_from_range.cc b/libstdc++-v3/testsuite/23_containers/priority_queue/cons_from_range.cc index 977ef981b871..87e404bdade5 100644 --- a/libstdc++-v3/testsuite/23_containers/priority_queue/cons_from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/priority_queue/cons_from_range.cc @@ -1,7 +1,12 @@ // { dg-do run { target c++23 } } -#include <algorithm> #include <queue> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <queue>" +#endif + +#include <algorithm> #include <ranges> #include <span> #include <testsuite_allocator.h> diff --git a/libstdc++-v3/testsuite/23_containers/queue/cons_from_range.cc b/libstdc++-v3/testsuite/23_containers/queue/cons_from_range.cc index c21f52cb1e2e..039d084fc040 100644 --- a/libstdc++-v3/testsuite/23_containers/queue/cons_from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/queue/cons_from_range.cc @@ -1,7 +1,12 @@ // { dg-do run { target c++23 } } -#include <list> #include <queue> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <queue>" +#endif + +#include <list> #include <span> #include <testsuite_allocator.h> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/23_containers/set/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/set/cons/from_range.cc index 869326f89765..efde05d729cf 100644 --- a/libstdc++-v3/testsuite/23_containers/set/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/set/cons/from_range.cc @@ -1,8 +1,13 @@ // { dg-do run { target c++23 } } +#include <set> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <set>" +#endif + #include <algorithm> #include <ranges> -#include <set> #include <span> #include <testsuite_allocator.h> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/23_containers/stack/cons_from_range.cc b/libstdc++-v3/testsuite/23_containers/stack/cons_from_range.cc index e957d0c4450a..2ee52e1cf9a4 100644 --- a/libstdc++-v3/testsuite/23_containers/stack/cons_from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/stack/cons_from_range.cc @@ -1,8 +1,13 @@ // { dg-do run { target c++23 } } +#include <stack> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <span>" +#endif + #include <ranges> #include <span> -#include <stack> #include <testsuite_allocator.h> #include <testsuite_hooks.h> #include <testsuite_iterators.h> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/from_range.cc index 6d1da5bf5d18..36efc2de5a39 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/from_range.cc @@ -1,7 +1,12 @@ // { dg-do run { target c++23 } } -#include <algorithm> #include <unordered_map> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <unordered_map>" +#endif + +#include <algorithm> #include <span> #include <testsuite_allocator.h> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/from_range.cc index 2ca93d344e9b..b551df49f3e7 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/from_range.cc @@ -1,7 +1,12 @@ // { dg-do run { target c++23 } } -#include <algorithm> #include <unordered_map> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <unordered_map>" +#endif + +#include <algorithm> #include <ranges> #include <span> #include <testsuite_allocator.h> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/from_range.cc index 45c3848f5ce3..d44598d7d615 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/from_range.cc @@ -1,7 +1,12 @@ // { dg-do run { target c++23 } } -#include <algorithm> #include <unordered_set> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <unordered_set>" +#endif + +#include <algorithm> #include <ranges> #include <span> #include <testsuite_allocator.h> diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/from_range.cc index 0806045539f2..8259be871f6e 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/from_range.cc @@ -1,7 +1,12 @@ // { dg-do run { target c++23 } } -#include <algorithm> #include <unordered_set> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <unordered_set>" +#endif + +#include <algorithm> #include <span> #include <testsuite_allocator.h> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/cons/from_range.cc index 37f0ecf32ad7..339c06bd70e9 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/bool/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/cons/from_range.cc @@ -1,5 +1,11 @@ // { dg-do run { target c++23 } } +#include <unordered_set> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <unordered_set>" +#endif + #include <vector> #include <span> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/from_range.cc index ed2e3ca6ba1e..7a62645283d2 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/cons/from_range.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/cons/from_range.cc @@ -1,6 +1,11 @@ // { dg-do run { target c++23 } } #include <vector> + +#if __cpp_lib_containers_ranges != 202202L +# error "Feature-test macro __cpp_lib_containers_ranges has wrong value in <vector>" +#endif + #include <span> #include <testsuite_hooks.h> #include <testsuite_iterators.h>