From b828d663db38e37dc94633fb14cc02ae21d7ae9a Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Sat, 21 Dec 2024 00:27:12 +0100 Subject: [PATCH] [libc++][C++03] Remove code that is not used in C++03 --- libcxx/include/__cxx03/__algorithm/equal.h | 59 - libcxx/include/__cxx03/__algorithm/for_each.h | 15 - .../__cxx03/__algorithm/is_permutation.h | 53 - .../__cxx03/__algorithm/iterator_operations.h | 25 - .../__cxx03/__algorithm/make_projected.h | 29 - libcxx/include/__cxx03/__algorithm/max.h | 15 - libcxx/include/__cxx03/__algorithm/min.h | 15 - libcxx/include/__cxx03/__algorithm/minmax.h | 19 - libcxx/include/__cxx03/__algorithm/mismatch.h | 46 - libcxx/include/__cxx03/__algorithm/search.h | 9 - libcxx/include/__cxx03/__algorithm/shuffle.h | 11 +- .../include/__cxx03/__algorithm/simd_utils.h | 6 +- libcxx/include/__cxx03/__algorithm/sort.h | 22 - .../__algorithm/three_way_comp_ref_type.h | 48 - .../uniform_random_bit_generator_adaptor.h | 38 - .../include/__cxx03/__algorithm/unwrap_iter.h | 8 - .../__cxx03/__algorithm/unwrap_range.h | 51 - libcxx/include/__cxx03/__atomic/aliases.h | 25 - libcxx/include/__cxx03/__atomic/atomic.h | 134 --- libcxx/include/__cxx03/__atomic/atomic_base.h | 8 - libcxx/include/__cxx03/__atomic/atomic_flag.h | 5 - libcxx/include/__cxx03/__atomic/atomic_init.h | 4 - .../__cxx03/__atomic/cxx_atomic_impl.h | 16 +- .../include/__cxx03/__atomic/memory_order.h | 25 - libcxx/include/__cxx03/__bit/countl.h | 14 - libcxx/include/__cxx03/__bit/countr.h | 14 - libcxx/include/__cxx03/__bit/popcount.h | 26 - libcxx/include/__cxx03/__bit/rotate.h | 14 - libcxx/include/__cxx03/__bit_reference | 31 +- libcxx/include/__cxx03/__chrono/duration.h | 127 +- .../include/__cxx03/__chrono/system_clock.h | 9 - libcxx/include/__cxx03/__chrono/time_point.h | 36 - libcxx/include/__cxx03/__config | 148 +-- .../__cxx03/__configuration/language.h | 19 - .../__cxx03/__debug_utils/randomize_range.h | 4 +- .../include/__cxx03/__exception/operations.h | 3 - .../__cxx03/__functional/binary_function.h | 11 - .../__cxx03/__functional/binary_negate.h | 4 - libcxx/include/__cxx03/__functional/bind.h | 226 ---- .../include/__cxx03/__functional/binder1st.h | 4 - .../include/__cxx03/__functional/binder2nd.h | 4 - libcxx/include/__cxx03/__functional/hash.h | 33 - .../include/__cxx03/__functional/identity.h | 20 - .../__cxx03/__functional/mem_fun_ref.h | 4 - .../include/__cxx03/__functional/operations.h | 328 ----- .../__functional/pointer_to_binary_function.h | 4 - .../__functional/pointer_to_unary_function.h | 4 - .../__cxx03/__functional/reference_wrapper.h | 61 +- .../__cxx03/__functional/unary_function.h | 11 - .../__cxx03/__functional/unary_negate.h | 4 - .../__cxx03/__functional/weak_result_type.h | 22 - libcxx/include/__cxx03/__fwd/array.h | 8 - libcxx/include/__cxx03/__fwd/complex.h | 16 - libcxx/include/__cxx03/__fwd/pair.h | 10 - libcxx/include/__cxx03/__fwd/string.h | 33 - libcxx/include/__cxx03/__fwd/tuple.h | 26 - libcxx/include/__cxx03/__hash_table | 168 +-- libcxx/include/__cxx03/__iterator/access.h | 41 - libcxx/include/__cxx03/__iterator/advance.h | 127 -- .../__cxx03/__iterator/back_insert_iterator.h | 17 +- .../include/__cxx03/__iterator/bounded_iter.h | 24 - .../__iterator/cpp17_iterator_concepts.h | 149 --- libcxx/include/__cxx03/__iterator/distance.h | 47 - .../__iterator/front_insert_iterator.h | 17 +- .../__cxx03/__iterator/insert_iterator.h | 23 +- .../__cxx03/__iterator/istream_iterator.h | 16 +- .../__cxx03/__iterator/istreambuf_iterator.h | 16 +- .../__cxx03/__iterator/iterator_traits.h | 272 ----- .../__cxx03/__iterator/move_iterator.h | 156 +-- libcxx/include/__cxx03/__iterator/next.h | 42 - .../__cxx03/__iterator/ostream_iterator.h | 10 +- .../__cxx03/__iterator/ostreambuf_iterator.h | 10 +- libcxx/include/__cxx03/__iterator/prev.h | 36 - .../__cxx03/__iterator/reverse_iterator.h | 137 +-- libcxx/include/__cxx03/__iterator/wrap_iter.h | 37 +- libcxx/include/__cxx03/__locale | 2 - .../__locale_dir/locale_base_api/ibm.h | 2 +- libcxx/include/__cxx03/__math/hypot.h | 51 - libcxx/include/__cxx03/__memory/addressof.h | 5 - .../include/__cxx03/__memory/aligned_alloc.h | 11 - .../__cxx03/__memory/allocate_at_least.h | 11 - libcxx/include/__cxx03/__memory/allocator.h | 97 +- .../__cxx03/__memory/allocator_arg_t.h | 43 - .../__cxx03/__memory/allocator_traits.h | 47 - .../include/__cxx03/__memory/assume_aligned.h | 9 - libcxx/include/__cxx03/__memory/auto_ptr.h | 4 - .../__cxx03/__memory/compressed_pair.h | 22 - .../include/__cxx03/__memory/construct_at.h | 50 - .../include/__cxx03/__memory/pointer_traits.h | 87 -- .../__cxx03/__memory/raw_storage_iterator.h | 22 +- libcxx/include/__cxx03/__memory/shared_ptr.h | 485 +------- .../include/__cxx03/__memory/swap_allocator.h | 14 +- libcxx/include/__cxx03/__memory/temp_value.h | 10 - .../__memory/uninitialized_algorithms.h | 341 ------ libcxx/include/__cxx03/__memory/unique_ptr.h | 113 +- .../include/__cxx03/__memory/uses_allocator.h | 5 - libcxx/include/__cxx03/__mutex/once_flag.h | 58 - libcxx/include/__cxx03/__mutex/tag_types.h | 10 - libcxx/include/__cxx03/__numeric/accumulate.h | 8 - .../__cxx03/__numeric/adjacent_difference.h | 8 - .../include/__cxx03/__numeric/inner_product.h | 8 - .../include/__cxx03/__numeric/partial_sum.h | 12 +- .../include/__cxx03/__ostream/basic_ostream.h | 63 - .../__cxx03/__random/bernoulli_distribution.h | 5 - .../__cxx03/__random/binomial_distribution.h | 6 - .../__cxx03/__random/cauchy_distribution.h | 6 - .../__random/chi_squared_distribution.h | 5 - .../__cxx03/__random/discard_block_engine.h | 11 - .../__cxx03/__random/discrete_distribution.h | 6 - .../__random/exponential_distribution.h | 5 - .../__random/extreme_value_distribution.h | 6 - .../__cxx03/__random/fisher_f_distribution.h | 6 - .../__cxx03/__random/gamma_distribution.h | 6 - .../__cxx03/__random/generate_canonical.h | 8 +- .../__cxx03/__random/geometric_distribution.h | 5 - .../__random/independent_bits_engine.h | 9 +- .../__random/linear_congruential_engine.h | 5 - .../__cxx03/__random/lognormal_distribution.h | 5 - .../__random/mersenne_twister_engine.h | 5 - .../__random/negative_binomial_distribution.h | 5 - .../__cxx03/__random/normal_distribution.h | 6 - .../piecewise_constant_distribution.h | 33 - .../__random/piecewise_linear_distribution.h | 33 - .../__cxx03/__random/poisson_distribution.h | 5 - .../include/__cxx03/__random/random_device.h | 5 - libcxx/include/__cxx03/__random/seed_seq.h | 6 - .../__cxx03/__random/shuffle_order_engine.h | 8 - .../__cxx03/__random/student_t_distribution.h | 5 - .../__random/subtract_with_carry_engine.h | 5 - .../__random/uniform_int_distribution.h | 13 +- .../__random/uniform_real_distribution.h | 6 - .../__cxx03/__random/weibull_distribution.h | 6 - libcxx/include/__cxx03/__string/char_traits.h | 6 - .../__cxx03/__string/constexpr_c_functions.h | 10 +- .../__cxx03/__system_error/error_category.h | 10 - .../__cxx03/__system_error/error_code.h | 19 - .../__cxx03/__system_error/error_condition.h | 20 - libcxx/include/__cxx03/__thread/id.h | 18 - libcxx/include/__cxx03/__thread/thread.h | 39 - libcxx/include/__cxx03/__tree | 178 +-- libcxx/include/__cxx03/__tuple/find_index.h | 42 - .../__cxx03/__tuple/make_tuple_types.h | 52 - .../include/__cxx03/__tuple/sfinae_helpers.h | 106 -- .../include/__cxx03/__tuple/tuple_element.h | 15 - .../include/__cxx03/__tuple/tuple_indices.h | 17 - libcxx/include/__cxx03/__tuple/tuple_like.h | 16 - .../include/__cxx03/__tuple/tuple_like_ext.h | 5 - .../__cxx03/__tuple/tuple_like_no_subrange.h | 32 - libcxx/include/__cxx03/__tuple/tuple_size.h | 38 - .../include/__cxx03/__type_traits/add_const.h | 5 - libcxx/include/__cxx03/__type_traits/add_cv.h | 5 - .../__type_traits/add_lvalue_reference.h | 5 - .../__cxx03/__type_traits/add_pointer.h | 5 - .../__type_traits/add_rvalue_reference.h | 5 - .../__cxx03/__type_traits/add_volatile.h | 5 - .../__cxx03/__type_traits/aligned_storage.h | 9 - .../__cxx03/__type_traits/aligned_union.h | 5 - .../__cxx03/__type_traits/alignment_of.h | 5 - .../__cxx03/__type_traits/common_type.h | 23 - .../__cxx03/__type_traits/conditional.h | 5 - .../__cxx03/__type_traits/conjunction.h | 16 - libcxx/include/__cxx03/__type_traits/decay.h | 5 - .../__cxx03/__type_traits/disjunction.h | 10 - .../include/__cxx03/__type_traits/enable_if.h | 5 - libcxx/include/__cxx03/__type_traits/extent.h | 10 - .../__type_traits/has_virtual_destructor.h | 5 - .../__cxx03/__type_traits/integral_constant.h | 8 - libcxx/include/__cxx03/__type_traits/invoke.h | 49 - .../__cxx03/__type_traits/is_abstract.h | 5 - .../__cxx03/__type_traits/is_arithmetic.h | 5 - .../include/__cxx03/__type_traits/is_array.h | 10 - .../__cxx03/__type_traits/is_assignable.h | 15 - .../__cxx03/__type_traits/is_base_of.h | 5 - .../__cxx03/__type_traits/is_bounded_array.h | 12 - .../include/__cxx03/__type_traits/is_class.h | 5 - .../__cxx03/__type_traits/is_compound.h | 10 - .../include/__cxx03/__type_traits/is_const.h | 10 - .../__type_traits/is_constant_evaluated.h | 6 - .../__cxx03/__type_traits/is_constructible.h | 20 - .../__cxx03/__type_traits/is_convertible.h | 5 - .../__cxx03/__type_traits/is_destructible.h | 10 - .../include/__cxx03/__type_traits/is_empty.h | 5 - .../include/__cxx03/__type_traits/is_enum.h | 15 - .../__type_traits/is_execution_policy.h | 40 - .../include/__cxx03/__type_traits/is_final.h | 10 - .../__cxx03/__type_traits/is_floating_point.h | 5 - .../__cxx03/__type_traits/is_function.h | 5 - .../__cxx03/__type_traits/is_fundamental.h | 10 - .../is_implicitly_default_constructible.h | 22 - .../__cxx03/__type_traits/is_integral.h | 10 - .../__cxx03/__type_traits/is_literal_type.h | 7 - .../__cxx03/__type_traits/is_member_pointer.h | 11 - .../__type_traits/is_nothrow_assignable.h | 15 - .../__type_traits/is_nothrow_constructible.h | 20 - .../__type_traits/is_nothrow_destructible.h | 5 - .../__cxx03/__type_traits/is_null_pointer.h | 10 - .../include/__cxx03/__type_traits/is_object.h | 5 - libcxx/include/__cxx03/__type_traits/is_pod.h | 5 - .../__cxx03/__type_traits/is_pointer.h | 10 - .../__cxx03/__type_traits/is_polymorphic.h | 5 - .../__cxx03/__type_traits/is_reference.h | 20 - .../include/__cxx03/__type_traits/is_same.h | 5 - .../include/__cxx03/__type_traits/is_scalar.h | 10 - .../include/__cxx03/__type_traits/is_signed.h | 10 - .../__cxx03/__type_traits/is_specialization.h | 10 - .../__type_traits/is_standard_layout.h | 5 - .../__cxx03/__type_traits/is_swappable.h | 42 - .../__cxx03/__type_traits/is_trivial.h | 5 - .../__type_traits/is_trivially_assignable.h | 15 - .../is_trivially_constructible.h | 20 - .../__type_traits/is_trivially_copyable.h | 10 - .../__type_traits/is_trivially_destructible.h | 5 - .../__type_traits/is_unbounded_array.h | 12 - .../include/__cxx03/__type_traits/is_union.h | 5 - .../__cxx03/__type_traits/is_unsigned.h | 10 - .../include/__cxx03/__type_traits/is_void.h | 5 - .../__cxx03/__type_traits/is_volatile.h | 10 - .../__type_traits/make_32_64_or_128_bit.h | 3 - .../__cxx03/__type_traits/make_signed.h | 5 - .../__cxx03/__type_traits/make_unsigned.h | 12 - libcxx/include/__cxx03/__type_traits/nat.h | 9 +- .../include/__cxx03/__type_traits/negation.h | 7 - .../noexcept_move_assign_container.h | 10 +- libcxx/include/__cxx03/__type_traits/rank.h | 5 - .../__type_traits/remove_all_extents.h | 5 - .../__cxx03/__type_traits/remove_const.h | 5 - .../include/__cxx03/__type_traits/remove_cv.h | 5 - .../__cxx03/__type_traits/remove_cvref.h | 10 - .../__cxx03/__type_traits/remove_extent.h | 5 - .../__cxx03/__type_traits/remove_pointer.h | 5 - .../__cxx03/__type_traits/remove_reference.h | 5 - .../__cxx03/__type_traits/remove_volatile.h | 5 - .../include/__cxx03/__type_traits/result_of.h | 7 - .../__cxx03/__type_traits/strip_signature.h | 63 - .../__cxx03/__type_traits/type_identity.h | 9 - .../__cxx03/__type_traits/underlying_type.h | 5 - .../__cxx03/__type_traits/unwrap_ref.h | 23 +- libcxx/include/__cxx03/__type_traits/void_t.h | 5 - libcxx/include/__cxx03/__utility/as_lvalue.h | 9 - .../__cxx03/__utility/integer_sequence.h | 42 - libcxx/include/__cxx03/__utility/pair.h | 430 +------ .../__cxx03/__utility/piecewise_construct.h | 6 - .../include/__cxx03/__utility/small_buffer.h | 73 -- libcxx/include/__cxx03/__utility/swap.h | 5 - .../include/__cxx03/__utility/unreachable.h | 6 - libcxx/include/__cxx03/__variant/monostate.h | 38 - libcxx/include/__cxx03/algorithm | 6 +- libcxx/include/__cxx03/array | 51 +- libcxx/include/__cxx03/atomic | 4 +- libcxx/include/__cxx03/bitset | 63 +- libcxx/include/__cxx03/chrono | 12 +- libcxx/include/__cxx03/cmath | 41 +- libcxx/include/__cxx03/codecvt | 6 +- libcxx/include/__cxx03/complex | 146 +-- libcxx/include/__cxx03/condition_variable | 100 +- libcxx/include/__cxx03/cstddef | 69 -- libcxx/include/__cxx03/cstdio | 2 - libcxx/include/__cxx03/cstdlib | 7 - libcxx/include/__cxx03/ctime | 6 - libcxx/include/__cxx03/cuchar | 16 - libcxx/include/__cxx03/cwchar | 6 +- libcxx/include/__cxx03/deque | 463 +------- libcxx/include/__cxx03/exception | 2 +- libcxx/include/__cxx03/ext/hash_map | 9 +- libcxx/include/__cxx03/ext/hash_set | 2 +- libcxx/include/__cxx03/forward_list | 313 +---- libcxx/include/__cxx03/fstream | 115 +- libcxx/include/__cxx03/functional | 11 +- libcxx/include/__cxx03/future | 120 +- libcxx/include/__cxx03/iomanip | 32 - libcxx/include/__cxx03/ios | 13 +- libcxx/include/__cxx03/iosfwd | 20 - libcxx/include/__cxx03/istream | 29 +- libcxx/include/__cxx03/iterator | 2 +- libcxx/include/__cxx03/limits | 2 +- libcxx/include/__cxx03/list | 354 +----- libcxx/include/__cxx03/locale | 34 +- libcxx/include/__cxx03/map | 814 +------------ libcxx/include/__cxx03/memory | 16 +- libcxx/include/__cxx03/mutex | 141 +-- libcxx/include/__cxx03/new | 42 +- libcxx/include/__cxx03/numeric | 4 +- libcxx/include/__cxx03/ostream | 6 +- libcxx/include/__cxx03/queue | 352 +----- libcxx/include/__cxx03/random | 2 +- libcxx/include/__cxx03/ratio | 58 +- libcxx/include/__cxx03/regex | 182 +-- libcxx/include/__cxx03/set | 557 +-------- libcxx/include/__cxx03/sstream | 386 +----- libcxx/include/__cxx03/stack | 118 +- libcxx/include/__cxx03/stdatomic.h | 4 +- libcxx/include/__cxx03/stdexcept | 2 +- libcxx/include/__cxx03/streambuf | 2 +- libcxx/include/__cxx03/string | 633 +--------- libcxx/include/__cxx03/string_view | 155 +-- libcxx/include/__cxx03/strstream | 84 -- libcxx/include/__cxx03/system_error | 2 +- libcxx/include/__cxx03/thread | 4 +- libcxx/include/__cxx03/type_traits | 22 - libcxx/include/__cxx03/typeindex | 13 +- libcxx/include/__cxx03/typeinfo | 6 +- libcxx/include/__cxx03/uchar.h | 15 - libcxx/include/__cxx03/unordered_map | 1055 +---------------- libcxx/include/__cxx03/unordered_set | 754 +----------- libcxx/include/__cxx03/utility | 12 +- libcxx/include/__cxx03/valarray | 163 +-- libcxx/include/__cxx03/vector | 416 +------ libcxx/include/__cxx03/version | 293 ----- 308 files changed, 165 insertions(+), 15503 deletions(-) diff --git a/libcxx/include/__cxx03/__algorithm/equal.h b/libcxx/include/__cxx03/__algorithm/equal.h index 25b2d5ba0a825..e1d458590e614 100644 --- a/libcxx/include/__cxx03/__algorithm/equal.h +++ b/libcxx/include/__cxx03/__algorithm/equal.h @@ -66,65 +66,6 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first return std::equal(__first1, __last1, __first2, __equal_to()); } -#if _LIBCPP_STD_VER >= 14 - -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_impl( - _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __comp, _Proj1& __proj1, _Proj2& __proj2) { - while (__first1 != __last1 && __first2 != __last2) { - if (!std::__invoke(__comp, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2))) - return false; - ++__first1; - ++__first2; - } - return __first1 == __last1 && __first2 == __last2; -} - -template && __is_identity<_Proj1>::value && - __is_identity<_Proj2>::value && !is_volatile<_Tp>::value && !is_volatile<_Up>::value && - __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value, - int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool -__equal_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _Up*, _Pred&, _Proj1&, _Proj2&) { - return std::__constexpr_memcmp_equal(__first1, __first2, __element_count(__last1 - __first1)); -} - -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool -equal(_InputIterator1 __first1, - _InputIterator1 __last1, - _InputIterator2 __first2, - _InputIterator2 __last2, - _BinaryPredicate __pred) { - if constexpr (__has_random_access_iterator_category<_InputIterator1>::value && - __has_random_access_iterator_category<_InputIterator2>::value) { - if (std::distance(__first1, __last1) != std::distance(__first2, __last2)) - return false; - } - __identity __proj; - return std::__equal_impl( - std::__unwrap_iter(__first1), - std::__unwrap_iter(__last1), - std::__unwrap_iter(__first2), - std::__unwrap_iter(__last2), - __pred, - __proj, - __proj); -} - -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool -equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { - return std::equal(__first1, __last1, __first2, __last2, __equal_to()); -} - -#endif // _LIBCPP_STD_VER >= 14 - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__cxx03/__algorithm/for_each.h b/libcxx/include/__cxx03/__algorithm/for_each.h index b1b16d46127cb..f79eb434465cf 100644 --- a/libcxx/include/__cxx03/__algorithm/for_each.h +++ b/libcxx/include/__cxx03/__algorithm/for_each.h @@ -33,21 +33,6 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f) { return __f; } -// __movable_box is available in C++20, but is actually a copyable-box, so optimization is only correct in C++23 -#if _LIBCPP_STD_VER >= 23 -template - requires __is_segmented_iterator<_SegmentedIterator>::value -_LIBCPP_HIDE_FROM_ABI constexpr _Function -for_each(_SegmentedIterator __first, _SegmentedIterator __last, _Function __func) { - ranges::__movable_box<_Function> __wrapped_func(in_place, std::move(__func)); - std::__for_each_segment(__first, __last, [&](auto __lfirst, auto __llast) { - __wrapped_func = - ranges::__movable_box<_Function>(in_place, std::for_each(__lfirst, __llast, std::move(*__wrapped_func))); - }); - return std::move(*__wrapped_func); -} -#endif // _LIBCPP_STD_VER >= 23 - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__cxx03/__algorithm/is_permutation.h b/libcxx/include/__cxx03/__algorithm/is_permutation.h index 558077f8ab81f..3089acf119845 100644 --- a/libcxx/include/__cxx03/__algorithm/is_permutation.h +++ b/libcxx/include/__cxx03/__algorithm/is_permutation.h @@ -33,18 +33,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD template struct _ConstTimeDistance : false_type {}; -#if _LIBCPP_STD_VER >= 20 - -template -struct _ConstTimeDistance<_Iter1, - _Sent1, - _Iter2, - _Sent2, - __enable_if_t< sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2> >> - : true_type {}; - -#else - template struct _ConstTimeDistance< _Iter1, @@ -55,8 +43,6 @@ struct _ConstTimeDistance< is_same::iterator_category, random_access_iterator_tag>::value > > : true_type {}; -#endif // _LIBCPP_STD_VER >= 20 - // Internal functions // For each element in [f1, l1) see if there are the same number of equal elements in [f2, l2) @@ -261,45 +247,6 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIt return std::is_permutation(__first1, __last1, __first2, __equal_to()); } -#if _LIBCPP_STD_VER >= 14 - -// 2+2 iterators -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation( - _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { - return std::__is_permutation<_ClassicAlgPolicy>( - std::move(__first1), - std::move(__last1), - std::move(__first2), - std::move(__last2), - __equal_to(), - __identity(), - __identity()); -} - -// 2+2 iterators, predicate -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool is_permutation( - _ForwardIterator1 __first1, - _ForwardIterator1 __last1, - _ForwardIterator2 __first2, - _ForwardIterator2 __last2, - _BinaryPredicate __pred) { - static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value, - "The predicate has to be callable"); - - return std::__is_permutation<_ClassicAlgPolicy>( - std::move(__first1), - std::move(__last1), - std::move(__first2), - std::move(__last2), - __pred, - __identity(), - __identity()); -} - -#endif // _LIBCPP_STD_VER >= 14 - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__cxx03/__algorithm/iterator_operations.h b/libcxx/include/__cxx03/__algorithm/iterator_operations.h index 6ed7d537134ed..c594723e7d906 100644 --- a/libcxx/include/__cxx03/__algorithm/iterator_operations.h +++ b/libcxx/include/__cxx03/__algorithm/iterator_operations.h @@ -37,31 +37,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD template struct _IterOps; -#if _LIBCPP_STD_VER >= 20 -struct _RangeAlgPolicy {}; - -template <> -struct _IterOps<_RangeAlgPolicy> { - template - using __value_type = iter_value_t<_Iter>; - - template - using __iterator_category = ranges::__iterator_concept<_Iter>; - - template - using __difference_type = iter_difference_t<_Iter>; - - static constexpr auto advance = ranges::advance; - static constexpr auto distance = ranges::distance; - static constexpr auto __iter_move = ranges::iter_move; - static constexpr auto iter_swap = ranges::iter_swap; - static constexpr auto next = ranges::next; - static constexpr auto prev = ranges::prev; - static constexpr auto __advance_to = ranges::advance; -}; - -#endif - struct _ClassicAlgPolicy {}; template <> diff --git a/libcxx/include/__cxx03/__algorithm/make_projected.h b/libcxx/include/__cxx03/__algorithm/make_projected.h index be36426d3b58e..68cda60d4e473 100644 --- a/libcxx/include/__cxx03/__algorithm/make_projected.h +++ b/libcxx/include/__cxx03/__algorithm/make_projected.h @@ -73,33 +73,4 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Pred& __make_projected(_Pred& __pred, _ _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 - -_LIBCPP_BEGIN_NAMESPACE_STD - -namespace ranges { - -template -_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) { - if constexpr (__is_identity>::value && __is_identity>::value && - !is_member_pointer_v>) { - // Avoid creating the lambda and just use the pristine comparator -- for certain algorithms, this would enable - // optimizations that rely on the type of the comparator. - return __comp; - - } else { - return [&](auto&& __lhs, auto&& __rhs) -> bool { - return std::invoke(__comp, - std::invoke(__proj1, std::forward(__lhs)), - std::invoke(__proj2, std::forward(__rhs))); - }; - } -} - -} // namespace ranges - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_STD_VER >= 20 - #endif // _LIBCPP___CXX03___ALGORITHM_MAKE_PROJECTED_H diff --git a/libcxx/include/__cxx03/__algorithm/max.h b/libcxx/include/__cxx03/__algorithm/max.h index 7b13e78c2761a..50dfd03843bdd 100644 --- a/libcxx/include/__cxx03/__algorithm/max.h +++ b/libcxx/include/__cxx03/__algorithm/max.h @@ -35,21 +35,6 @@ max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) return std::max(__a, __b, __less<>()); } -#ifndef _LIBCPP_CXX03_LANG - -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp -max(initializer_list<_Tp> __t, _Compare __comp) { - return *std::__max_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp); -} - -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp max(initializer_list<_Tp> __t) { - return *std::max_element(__t.begin(), __t.end(), __less<>()); -} - -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__cxx03/__algorithm/min.h b/libcxx/include/__cxx03/__algorithm/min.h index 751c53a953828..b617f857102d4 100644 --- a/libcxx/include/__cxx03/__algorithm/min.h +++ b/libcxx/include/__cxx03/__algorithm/min.h @@ -35,21 +35,6 @@ min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) return std::min(__a, __b, __less<>()); } -#ifndef _LIBCPP_CXX03_LANG - -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp -min(initializer_list<_Tp> __t, _Compare __comp) { - return *std::__min_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp); -} - -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp min(initializer_list<_Tp> __t) { - return *std::min_element(__t.begin(), __t.end(), __less<>()); -} - -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__cxx03/__algorithm/minmax.h b/libcxx/include/__cxx03/__algorithm/minmax.h index 6569dafa3aafc..609bc623b913c 100644 --- a/libcxx/include/__cxx03/__algorithm/minmax.h +++ b/libcxx/include/__cxx03/__algorithm/minmax.h @@ -34,25 +34,6 @@ minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __ return std::minmax(__a, __b, __less<>()); } -#ifndef _LIBCPP_CXX03_LANG - -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Tp, _Tp> -minmax(initializer_list<_Tp> __t, _Compare __comp) { - static_assert(__is_callable<_Compare, _Tp, _Tp>::value, "The comparator has to be callable"); - __identity __proj; - auto __ret = std::__minmax_element_impl(__t.begin(), __t.end(), __comp, __proj); - return pair<_Tp, _Tp>(*__ret.first, *__ret.second); -} - -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Tp, _Tp> -minmax(initializer_list<_Tp> __t) { - return std::minmax(__t, __less<>()); -} - -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___ALGORITHM_MINMAX_H diff --git a/libcxx/include/__cxx03/__algorithm/mismatch.h b/libcxx/include/__cxx03/__algorithm/mismatch.h index 163bc8fb165c0..baf464c25e86f 100644 --- a/libcxx/include/__cxx03/__algorithm/mismatch.h +++ b/libcxx/include/__cxx03/__algorithm/mismatch.h @@ -164,52 +164,6 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi return std::mismatch(__first1, __last1, __first2, __equal_to()); } -#if _LIBCPP_STD_VER >= 14 -template -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter1, _Iter2> __mismatch( - _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { - while (__first1 != __last1 && __first2 != __last2) { - if (!std::__invoke(__pred, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2))) - break; - ++__first1; - ++__first2; - } - return {std::move(__first1), std::move(__first2)}; -} - -template -_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Tp*, _Tp*> -__mismatch(_Tp* __first1, _Tp* __last1, _Tp* __first2, _Tp* __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) { - auto __len = std::min(__last1 - __first1, __last2 - __first2); - return std::__mismatch(__first1, __first1 + __len, __first2, __pred, __proj1, __proj2); -} - -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> -mismatch(_InputIterator1 __first1, - _InputIterator1 __last1, - _InputIterator2 __first2, - _InputIterator2 __last2, - _BinaryPredicate __pred) { - __identity __proj; - auto __res = std::__mismatch( - std::__unwrap_iter(__first1), - std::__unwrap_iter(__last1), - std::__unwrap_iter(__first2), - std::__unwrap_iter(__last2), - __pred, - __proj, - __proj); - return {std::__rewrap_iter(__first1, __res.first), std::__rewrap_iter(__first2, __res.second)}; -} - -template -_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2> -mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { - return std::mismatch(__first1, __last1, __first2, __last2, __equal_to()); -} -#endif - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__cxx03/__algorithm/search.h b/libcxx/include/__cxx03/__algorithm/search.h index fd9aa0e4ffc77..f235510c33905 100644 --- a/libcxx/include/__cxx03/__algorithm/search.h +++ b/libcxx/include/__cxx03/__algorithm/search.h @@ -177,15 +177,6 @@ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 return std::search(__first1, __last1, __first2, __last2, __equal_to()); } -#if _LIBCPP_STD_VER >= 17 -template -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator -search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher& __s) { - return __s(__f, __l).first; -} - -#endif - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___ALGORITHM_SEARCH_H diff --git a/libcxx/include/__cxx03/__algorithm/shuffle.h b/libcxx/include/__cxx03/__algorithm/shuffle.h index abb96bce40236..173af1bf25290 100644 --- a/libcxx/include/__cxx03/__algorithm/shuffle.h +++ b/libcxx/include/__cxx03/__algorithm/shuffle.h @@ -62,7 +62,6 @@ class _LIBCPP_EXPORTED_FROM_ABI __libcpp_debug_randomizer { } }; -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) || defined(_LIBCPP_BUILDING_LIBRARY) class _LIBCPP_EXPORTED_FROM_ABI __rs_default; _LIBCPP_EXPORTED_FROM_ABI __rs_default __rs_get(); @@ -111,14 +110,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) { template _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void -random_shuffle(_RandomAccessIterator __first, - _RandomAccessIterator __last, -# ifndef _LIBCPP_CXX03_LANG - _RandomNumberGenerator&& __rand) -# else - _RandomNumberGenerator& __rand) -# endif -{ +random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _RandomNumberGenerator&& __rand) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; difference_type __d = __last - __first; if (__d > 1) { @@ -129,7 +121,6 @@ random_shuffle(_RandomAccessIterator __first, } } } -#endif template _LIBCPP_HIDE_FROM_ABI _RandomAccessIterator diff --git a/libcxx/include/__cxx03/__algorithm/simd_utils.h b/libcxx/include/__cxx03/__algorithm/simd_utils.h index 1cd6ae2893672..7b0e825afaa1f 100644 --- a/libcxx/include/__cxx03/__algorithm/simd_utils.h +++ b/libcxx/include/__cxx03/__algorithm/simd_utils.h @@ -27,11 +27,7 @@ _LIBCPP_PUSH_MACROS #include <__cxx03/__undef_macros> // TODO: Find out how altivec changes things and allow vectorizations there too. -#if _LIBCPP_STD_VER >= 14 && defined(_LIBCPP_CLANG_VER) && !defined(__ALTIVEC__) -# define _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS 1 -#else -# define _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS 0 -#endif +#define _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS 0 #if _LIBCPP_HAS_ALGORITHM_VECTOR_UTILS && !defined(__OPTIMIZE_SIZE__) # define _LIBCPP_VECTORIZE_ALGORITHMS 1 diff --git a/libcxx/include/__cxx03/__algorithm/sort.h b/libcxx/include/__cxx03/__algorithm/sort.h index f0f1babe731ed..b89843f514673 100644 --- a/libcxx/include/__cxx03/__algorithm/sort.h +++ b/libcxx/include/__cxx03/__algorithm/sort.h @@ -135,12 +135,6 @@ template struct __is_simple_comparator&> : true_type {}; template struct __is_simple_comparator&> : true_type {}; -#if _LIBCPP_STD_VER >= 20 -template <> -struct __is_simple_comparator : true_type {}; -template <> -struct __is_simple_comparator : true_type {}; -#endif template ::value_type> using __use_branchless_sort = @@ -966,22 +960,6 @@ _LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, less<_ std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp); } -#if _LIBCPP_STD_VER >= 14 -template ::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, less<>&) { - __less<_Type> __comp; - std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp); -} -#endif - -#if _LIBCPP_STD_VER >= 20 -template ::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, ranges::less&) { - __less<_Type> __comp; - std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp); -} -#endif - template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) { diff --git a/libcxx/include/__cxx03/__algorithm/three_way_comp_ref_type.h b/libcxx/include/__cxx03/__algorithm/three_way_comp_ref_type.h index 4463bd2115482..7e978b8df3fae 100644 --- a/libcxx/include/__cxx03/__algorithm/three_way_comp_ref_type.h +++ b/libcxx/include/__cxx03/__algorithm/three_way_comp_ref_type.h @@ -21,54 +21,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 - -template -struct __debug_three_way_comp { - _Comp& __comp_; - _LIBCPP_HIDE_FROM_ABI constexpr __debug_three_way_comp(_Comp& __c) : __comp_(__c) {} - - template - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(const _Tp& __x, const _Up& __y) { - auto __r = __comp_(__x, __y); - if constexpr (__comparison_category) - __do_compare_assert(__y, __x, __r); - return __r; - } - - template - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp& __x, _Up& __y) { - auto __r = __comp_(__x, __y); - if constexpr (__comparison_category) - __do_compare_assert(__y, __x, __r); - return __r; - } - - template - _LIBCPP_HIDE_FROM_ABI constexpr void __do_compare_assert(_LHS& __l, _RHS& __r, _Order __o) { - _Order __expected = __o; - if (__o == _Order::less) - __expected = _Order::greater; - if (__o == _Order::greater) - __expected = _Order::less; - _LIBCPP_ASSERT_SEMANTIC_REQUIREMENT( - __comp_(__l, __r) == __expected, "Comparator does not induce a strict weak ordering"); - (void)__l; - (void)__r; - } -}; - -// Pass the comparator by lvalue reference. Or in the debug mode, using a debugging wrapper that stores a reference. -# if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG -template -using __three_way_comp_ref_type = __debug_three_way_comp<_Comp>; -# else -template -using __three_way_comp_ref_type = _Comp&; -# endif - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H diff --git a/libcxx/include/__cxx03/__algorithm/uniform_random_bit_generator_adaptor.h b/libcxx/include/__cxx03/__algorithm/uniform_random_bit_generator_adaptor.h index 8d3858226b992..ef789bf138f62 100644 --- a/libcxx/include/__cxx03/__algorithm/uniform_random_bit_generator_adaptor.h +++ b/libcxx/include/__cxx03/__algorithm/uniform_random_bit_generator_adaptor.h @@ -17,42 +17,4 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER >= 20 - -_LIBCPP_PUSH_MACROS -# include <__cxx03/__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -// Range versions of random algorithms (e.g. `std::shuffle`) are less constrained than their classic counterparts. -// Range algorithms only require the given generator to satisfy the `std::uniform_random_bit_generator` concept. -// Classic algorithms require the given generator to meet the uniform random bit generator requirements; these -// requirements include satisfying `std::uniform_random_bit_generator` and add a requirement for the generator to -// provide a nested `result_type` typedef (see `[rand.req.urng]`). -// -// To be able to reuse classic implementations, make the given generator meet the classic requirements by wrapping -// it into an adaptor type that forwards all of its interface and adds the required typedef. -template -class _ClassicGenAdaptor { -private: - // The generator is not required to be copyable or movable, so it has to be stored as a reference. - _Gen& __gen_; - -public: - using result_type = invoke_result_t<_Gen&>; - - _LIBCPP_HIDE_FROM_ABI static constexpr auto min() { return __remove_cvref_t<_Gen>::min(); } - _LIBCPP_HIDE_FROM_ABI static constexpr auto max() { return __remove_cvref_t<_Gen>::max(); } - - _LIBCPP_HIDE_FROM_ABI constexpr explicit _ClassicGenAdaptor(_Gen& __g) : __gen_(__g) {} - - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()() const { return __gen_(); } -}; - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_STD_VER >= 20 - #endif // _LIBCPP___CXX03___ALGORITHM_RANGES_UNIFORM_RANDOM_BIT_GENERATOR_ADAPTOR_H diff --git a/libcxx/include/__cxx03/__algorithm/unwrap_iter.h b/libcxx/include/__cxx03/__algorithm/unwrap_iter.h index 055f56b9db155..b79dcd46b1fa2 100644 --- a/libcxx/include/__cxx03/__algorithm/unwrap_iter.h +++ b/libcxx/include/__cxx03/__algorithm/unwrap_iter.h @@ -65,14 +65,6 @@ __unwrap_iter(_Iter __i) _NOEXCEPT { return _Impl::__unwrap(__i); } -// Allow input_iterators to be passed to __unwrap_iter (but not __rewrap_iter) -#if _LIBCPP_STD_VER >= 20 -template ::value, int> = 0> -inline _LIBCPP_HIDE_FROM_ABI constexpr _Iter __unwrap_iter(_Iter __i) noexcept { - return __i; -} -#endif - template > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _OrigIter __rewrap_iter(_OrigIter __orig_iter, _Iter __iter) _NOEXCEPT { return _Impl::__rewrap(std::move(__orig_iter), std::move(__iter)); diff --git a/libcxx/include/__cxx03/__algorithm/unwrap_range.h b/libcxx/include/__cxx03/__algorithm/unwrap_range.h index 144f57b44b445..ed1a6b167c608 100644 --- a/libcxx/include/__cxx03/__algorithm/unwrap_range.h +++ b/libcxx/include/__cxx03/__algorithm/unwrap_range.h @@ -29,56 +29,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD // __unwrap_iter and __rewrap_iter don't work for this, because they assume that the iterator and sentinel have // the same type. __unwrap_range tries to get two iterators and then forward to __unwrap_iter. -#if _LIBCPP_STD_VER >= 20 -template -struct __unwrap_range_impl { - _LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Sent __sent) - requires random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter> - { - auto __last = ranges::next(__first, __sent); - return pair{std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__last))}; - } - - _LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Sent __last) { - return pair{std::move(__first), std::move(__last)}; - } - - _LIBCPP_HIDE_FROM_ABI static constexpr auto - __rewrap(_Iter __orig_iter, decltype(std::__unwrap_iter(std::move(__orig_iter))) __iter) - requires random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter> - { - return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter)); - } - - _LIBCPP_HIDE_FROM_ABI static constexpr auto __rewrap(const _Iter&, _Iter __iter) - requires(!(random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>)) - { - return __iter; - } -}; - -template -struct __unwrap_range_impl<_Iter, _Iter> { - _LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Iter __last) { - return pair{std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__last))}; - } - - _LIBCPP_HIDE_FROM_ABI static constexpr auto - __rewrap(_Iter __orig_iter, decltype(std::__unwrap_iter(__orig_iter)) __iter) { - return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter)); - } -}; - -template -_LIBCPP_HIDE_FROM_ABI constexpr auto __unwrap_range(_Iter __first, _Sent __last) { - return __unwrap_range_impl<_Iter, _Sent>::__unwrap(std::move(__first), std::move(__last)); -} - -template < class _Sent, class _Iter, class _Unwrapped> -_LIBCPP_HIDE_FROM_ABI constexpr _Iter __rewrap_range(_Iter __orig_iter, _Unwrapped __iter) { - return __unwrap_range_impl<_Iter, _Sent>::__rewrap(std::move(__orig_iter), std::move(__iter)); -} -#else // _LIBCPP_STD_VER >= 20 template ()))> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR pair<_Unwrapped, _Unwrapped> __unwrap_range(_Iter __first, _Iter __last) { return std::make_pair(std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__last))); @@ -88,7 +38,6 @@ template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __rewrap_range(_Iter __orig_iter, _Unwrapped __iter) { return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter)); } -#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__cxx03/__atomic/aliases.h b/libcxx/include/__cxx03/__atomic/aliases.h index 918ffc35ccf63..4cb75ee8712fd 100644 --- a/libcxx/include/__cxx03/__atomic/aliases.h +++ b/libcxx/include/__cxx03/__atomic/aliases.h @@ -80,31 +80,6 @@ using atomic_ptrdiff_t = atomic; using atomic_intmax_t = atomic; using atomic_uintmax_t = atomic; -// C++20 atomic_{signed,unsigned}_lock_free: prefer the contention type most highly, then the largest lock-free type -#if _LIBCPP_STD_VER >= 20 -# if ATOMIC_LLONG_LOCK_FREE == 2 -using __largest_lock_free_type = long long; -# elif ATOMIC_INT_LOCK_FREE == 2 -using __largest_lock_free_type = int; -# elif ATOMIC_SHORT_LOCK_FREE == 2 -using __largest_lock_free_type = short; -# elif ATOMIC_CHAR_LOCK_FREE == 2 -using __largest_lock_free_type = char; -# else -# define _LIBCPP_NO_LOCK_FREE_TYPES // There are no lockfree types (this can happen on unusual platforms) -# endif - -# ifndef _LIBCPP_NO_LOCK_FREE_TYPES -using __contention_t_or_largest = - __conditional_t<__libcpp_is_always_lock_free<__cxx_contention_t>::__value, - __cxx_contention_t, - __largest_lock_free_type>; - -using atomic_signed_lock_free = atomic<__contention_t_or_largest>; -using atomic_unsigned_lock_free = atomic>; -# endif // !_LIBCPP_NO_LOCK_FREE_TYPES -#endif // C++20 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___ATOMIC_ALIASES_H diff --git a/libcxx/include/__cxx03/__atomic/atomic.h b/libcxx/include/__cxx03/__atomic/atomic.h index 9ac800613f824..f275ee32723f9 100644 --- a/libcxx/include/__cxx03/__atomic/atomic.h +++ b/libcxx/include/__cxx03/__atomic/atomic.h @@ -38,11 +38,7 @@ struct atomic : public __atomic_base<_Tp> { using value_type = _Tp; using difference_type = value_type; -#if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI atomic() = default; -#else _LIBCPP_HIDE_FROM_ABI atomic() _NOEXCEPT = default; -#endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {} @@ -121,136 +117,6 @@ struct atomic<_Tp*> : public __atomic_base<_Tp*> { atomic& operator=(const atomic&) volatile = delete; }; -#if _LIBCPP_STD_VER >= 20 -template - requires is_floating_point_v<_Tp> -struct atomic<_Tp> : __atomic_base<_Tp> { -private: - _LIBCPP_HIDE_FROM_ABI static constexpr bool __is_fp80_long_double() { - // Only x87-fp80 long double has 64-bit mantissa - return __LDBL_MANT_DIG__ == 64 && std::is_same_v<_Tp, long double>; - } - - _LIBCPP_HIDE_FROM_ABI static constexpr bool __has_rmw_builtin() { -# ifndef _LIBCPP_COMPILER_CLANG_BASED - return false; -# else - // The builtin __cxx_atomic_fetch_add errors during compilation for - // long double on platforms with fp80 format. - // For more details, see - // lib/Sema/SemaChecking.cpp function IsAllowedValueType - // LLVM Parser does not allow atomicrmw with x86_fp80 type. - // if (ValType->isSpecificBuiltinType(BuiltinType::LongDouble) && - // &Context.getTargetInfo().getLongDoubleFormat() == - // &llvm::APFloat::x87DoubleExtended()) - // For more info - // https://github.com/llvm/llvm-project/issues/68602 - // https://reviews.llvm.org/D53965 - return !__is_fp80_long_double(); -# endif - } - - template - _LIBCPP_HIDE_FROM_ABI static _Tp - __rmw_op(_This&& __self, _Tp __operand, memory_order __m, _Operation __operation, _BuiltinOp __builtin_op) { - if constexpr (__has_rmw_builtin()) { - return __builtin_op(std::addressof(std::forward<_This>(__self).__a_), __operand, __m); - } else { - _Tp __old = __self.load(memory_order_relaxed); - _Tp __new = __operation(__old, __operand); - while (!__self.compare_exchange_weak(__old, __new, __m, memory_order_relaxed)) { -# ifdef _LIBCPP_COMPILER_CLANG_BASED - if constexpr (__is_fp80_long_double()) { - // https://github.com/llvm/llvm-project/issues/47978 - // clang bug: __old is not updated on failure for atomic::compare_exchange_weak - // Note __old = __self.load(memory_order_relaxed) will not work - std::__cxx_atomic_load_inplace(std::addressof(__self.__a_), &__old, memory_order_relaxed); - } -# endif - __new = __operation(__old, __operand); - } - return __old; - } - } - - template - _LIBCPP_HIDE_FROM_ABI static _Tp __fetch_add(_This&& __self, _Tp __operand, memory_order __m) { - auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) { - return std::__cxx_atomic_fetch_add(__a, __builtin_operand, __order); - }; - return __rmw_op(std::forward<_This>(__self), __operand, __m, std::plus<>{}, __builtin_op); - } - - template - _LIBCPP_HIDE_FROM_ABI static _Tp __fetch_sub(_This&& __self, _Tp __operand, memory_order __m) { - auto __builtin_op = [](auto __a, auto __builtin_operand, auto __order) { - return std::__cxx_atomic_fetch_sub(__a, __builtin_operand, __order); - }; - return __rmw_op(std::forward<_This>(__self), __operand, __m, std::minus<>{}, __builtin_op); - } - -public: - using __base = __atomic_base<_Tp>; - using value_type = _Tp; - using difference_type = value_type; - - _LIBCPP_HIDE_FROM_ABI constexpr atomic() noexcept = default; - _LIBCPP_HIDE_FROM_ABI constexpr atomic(_Tp __d) noexcept : __base(__d) {} - - atomic(const atomic&) = delete; - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; - - _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) volatile noexcept - requires __base::is_always_lock_free - { - __base::store(__d); - return __d; - } - _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) noexcept { - __base::store(__d); - return __d; - } - - _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept - requires __base::is_always_lock_free - { - return __fetch_add(*this, __op, __m); - } - - _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept { - return __fetch_add(*this, __op, __m); - } - - _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept - requires __base::is_always_lock_free - { - return __fetch_sub(*this, __op, __m); - } - - _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept { - return __fetch_sub(*this, __op, __m); - } - - _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) volatile noexcept - requires __base::is_always_lock_free - { - return fetch_add(__op) + __op; - } - - _LIBCPP_HIDE_FROM_ABI _Tp operator+=(_Tp __op) noexcept { return fetch_add(__op) + __op; } - - _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) volatile noexcept - requires __base::is_always_lock_free - { - return fetch_sub(__op) - __op; - } - - _LIBCPP_HIDE_FROM_ABI _Tp operator-=(_Tp __op) noexcept { return fetch_sub(__op) - __op; } -}; - -#endif // _LIBCPP_STD_VER >= 20 - // atomic_is_lock_free template diff --git a/libcxx/include/__cxx03/__atomic/atomic_base.h b/libcxx/include/__cxx03/__atomic/atomic_base.h index e4d4929b8912e..81424bc40938d 100644 --- a/libcxx/include/__cxx03/__atomic/atomic_base.h +++ b/libcxx/include/__cxx03/__atomic/atomic_base.h @@ -32,10 +32,6 @@ struct __atomic_base // false { mutable __cxx_atomic_impl<_Tp> __a_; -#if _LIBCPP_STD_VER >= 17 - static constexpr bool is_always_lock_free = __libcpp_is_always_lock_free<__cxx_atomic_impl<_Tp> >::__value; -#endif - _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const volatile _NOEXCEPT { return __cxx_atomic_is_lock_free(sizeof(__cxx_atomic_impl<_Tp>)); } @@ -118,11 +114,7 @@ struct __atomic_base // false } _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); } -#if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI constexpr __atomic_base() noexcept(is_nothrow_default_constructible_v<_Tp>) : __a_(_Tp()) {} -#else _LIBCPP_HIDE_FROM_ABI __atomic_base() _NOEXCEPT = default; -#endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {} diff --git a/libcxx/include/__cxx03/__atomic/atomic_flag.h b/libcxx/include/__cxx03/__atomic/atomic_flag.h index c119e9bc498e6..fb2aac4ca9f78 100644 --- a/libcxx/include/__cxx03/__atomic/atomic_flag.h +++ b/libcxx/include/__cxx03/__atomic/atomic_flag.h @@ -68,12 +68,7 @@ struct atomic_flag { _LIBCPP_DEPRECATED_ATOMIC_SYNC _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { std::__atomic_notify_all(*this); } - -#if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI constexpr atomic_flag() _NOEXCEPT : __a_(false) {} -#else atomic_flag() _NOEXCEPT = default; -#endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION diff --git a/libcxx/include/__cxx03/__atomic/atomic_init.h b/libcxx/include/__cxx03/__atomic/atomic_init.h index edabfe1a12bb4..16b275243aa6c 100644 --- a/libcxx/include/__cxx03/__atomic/atomic_init.h +++ b/libcxx/include/__cxx03/__atomic/atomic_init.h @@ -18,8 +18,4 @@ #define ATOMIC_FLAG_INIT {false} #define ATOMIC_VAR_INIT(__v) {__v} -#if _LIBCPP_STD_VER >= 20 && defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) -# pragma clang deprecated(ATOMIC_VAR_INIT) -#endif - #endif // _LIBCPP___CXX03___ATOMIC_ATOMIC_INIT_H diff --git a/libcxx/include/__cxx03/__atomic/cxx_atomic_impl.h b/libcxx/include/__cxx03/__atomic/cxx_atomic_impl.h index 990d283c62d1a..2a0bb1a661892 100644 --- a/libcxx/include/__cxx03/__atomic/cxx_atomic_impl.h +++ b/libcxx/include/__cxx03/__atomic/cxx_atomic_impl.h @@ -44,13 +44,7 @@ _LIBCPP_HIDE_FROM_ABI void __cxx_atomic_assign_volatile(_Tp volatile& __a_value, template struct __cxx_atomic_base_impl { - _LIBCPP_HIDE_FROM_ABI -# ifndef _LIBCPP_CXX03_LANG - __cxx_atomic_base_impl() _NOEXCEPT = default; -# else - __cxx_atomic_base_impl() _NOEXCEPT : __a_value() { - } -# endif // _LIBCPP_CXX03_LANG + _LIBCPP_HIDE_FROM_ABI __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {} _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT : __a_value(value) {} _Tp __a_value; }; @@ -263,13 +257,7 @@ __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, memory_o template struct __cxx_atomic_base_impl { - _LIBCPP_HIDE_FROM_ABI -# ifndef _LIBCPP_CXX03_LANG - __cxx_atomic_base_impl() _NOEXCEPT = default; -# else - __cxx_atomic_base_impl() _NOEXCEPT : __a_value() { - } -# endif // _LIBCPP_CXX03_LANG + _LIBCPP_HIDE_FROM_ABI __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {} _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp __value) _NOEXCEPT : __a_value(__value) {} _LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value; }; diff --git a/libcxx/include/__cxx03/__atomic/memory_order.h b/libcxx/include/__cxx03/__atomic/memory_order.h index b8b9dda3d1150..d610c8609e8a3 100644 --- a/libcxx/include/__cxx03/__atomic/memory_order.h +++ b/libcxx/include/__cxx03/__atomic/memory_order.h @@ -26,29 +26,6 @@ enum __legacy_memory_order { __mo_relaxed, __mo_consume, __mo_acquire, __mo_rele using __memory_order_underlying_t = underlying_type<__legacy_memory_order>::type; -#if _LIBCPP_STD_VER >= 20 - -enum class memory_order : __memory_order_underlying_t { - relaxed = __mo_relaxed, - consume = __mo_consume, - acquire = __mo_acquire, - release = __mo_release, - acq_rel = __mo_acq_rel, - seq_cst = __mo_seq_cst -}; - -static_assert(is_same::type, __memory_order_underlying_t>::value, - "unexpected underlying type for std::memory_order"); - -inline constexpr auto memory_order_relaxed = memory_order::relaxed; -inline constexpr auto memory_order_consume = memory_order::consume; -inline constexpr auto memory_order_acquire = memory_order::acquire; -inline constexpr auto memory_order_release = memory_order::release; -inline constexpr auto memory_order_acq_rel = memory_order::acq_rel; -inline constexpr auto memory_order_seq_cst = memory_order::seq_cst; - -#else - enum memory_order { memory_order_relaxed = __mo_relaxed, memory_order_consume = __mo_consume, @@ -58,8 +35,6 @@ enum memory_order { memory_order_seq_cst = __mo_seq_cst, }; -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___ATOMIC_MEMORY_ORDER_H diff --git a/libcxx/include/__cxx03/__bit/countl.h b/libcxx/include/__cxx03/__bit/countl.h index e67fc4cacaacf..d73f9cac0fa41 100644 --- a/libcxx/include/__cxx03/__bit/countl.h +++ b/libcxx/include/__cxx03/__bit/countl.h @@ -91,20 +91,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero(_Tp __t) _ #endif // __has_builtin(__builtin_clzg) } -#if _LIBCPP_STD_VER >= 20 - -template <__libcpp_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr int countl_zero(_Tp __t) noexcept { - return std::__countl_zero(__t); -} - -template <__libcpp_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr int countl_one(_Tp __t) noexcept { - return __t != numeric_limits<_Tp>::max() ? std::countl_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits; -} - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__cxx03/__bit/countr.h b/libcxx/include/__cxx03/__bit/countr.h index 3fed2dd410329..84124669ed633 100644 --- a/libcxx/include/__cxx03/__bit/countr.h +++ b/libcxx/include/__cxx03/__bit/countr.h @@ -62,20 +62,6 @@ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __coun #endif // __has_builtin(__builtin_ctzg) } -#if _LIBCPP_STD_VER >= 20 - -template <__libcpp_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr int countr_zero(_Tp __t) noexcept { - return std::__countr_zero(__t); -} - -template <__libcpp_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr int countr_one(_Tp __t) noexcept { - return __t != numeric_limits<_Tp>::max() ? std::countr_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits; -} - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__cxx03/__bit/popcount.h b/libcxx/include/__cxx03/__bit/popcount.h index 59a6a7242708f..b91e80e1a6e5b 100644 --- a/libcxx/include/__cxx03/__bit/popcount.h +++ b/libcxx/include/__cxx03/__bit/popcount.h @@ -37,32 +37,6 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_popcount(unsigned lo return __builtin_popcountll(__x); } -#if _LIBCPP_STD_VER >= 20 - -template <__libcpp_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr int popcount(_Tp __t) noexcept { -# if __has_builtin(__builtin_popcountg) - return __builtin_popcountg(__t); -# else // __has_builtin(__builtin_popcountg) - if (sizeof(_Tp) <= sizeof(unsigned int)) - return std::__libcpp_popcount(static_cast(__t)); - else if (sizeof(_Tp) <= sizeof(unsigned long)) - return std::__libcpp_popcount(static_cast(__t)); - else if (sizeof(_Tp) <= sizeof(unsigned long long)) - return std::__libcpp_popcount(static_cast(__t)); - else { - int __ret = 0; - while (__t != 0) { - __ret += std::__libcpp_popcount(static_cast(__t)); - __t >>= numeric_limits::digits; - } - return __ret; - } -# endif // __has_builtin(__builtin_popcountg) -} - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__cxx03/__bit/rotate.h b/libcxx/include/__cxx03/__bit/rotate.h index d39d6ee090715..f828d73f73cb5 100644 --- a/libcxx/include/__cxx03/__bit/rotate.h +++ b/libcxx/include/__cxx03/__bit/rotate.h @@ -52,20 +52,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __rotr(_Tp __x, int __s) return (__x << -__r) | (__x >> (__N + __r)); } -#if _LIBCPP_STD_VER >= 20 - -template <__libcpp_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp rotl(_Tp __t, int __cnt) noexcept { - return std::__rotl(__t, __cnt); -} - -template <__libcpp_unsigned_integer _Tp> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp rotr(_Tp __t, int __cnt) noexcept { - return std::__rotr(__t, __cnt); -} - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___BIT_ROTATE_H diff --git a/libcxx/include/__cxx03/__bit_reference b/libcxx/include/__cxx03/__bit_reference index d4e01111eb0fe..ec87c4faf6474 100644 --- a/libcxx/include/__cxx03/__bit_reference +++ b/libcxx/include/__cxx03/__bit_reference @@ -75,16 +75,6 @@ public: return *this; } -#if _LIBCPP_STD_VER >= 23 - _LIBCPP_HIDE_FROM_ABI constexpr const __bit_reference& operator=(bool __x) const noexcept { - if (__x) - *__seg_ |= __mask_; - else - *__seg_ &= ~__mask_; - return *this; - } -#endif - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_reference& operator=(const __bit_reference& __x) _NOEXCEPT { return operator=(static_cast(__x)); } @@ -801,13 +791,7 @@ private: unsigned __ctz_; public: - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator() _NOEXCEPT -#if _LIBCPP_STD_VER >= 14 - : __seg_(nullptr), - __ctz_(0) -#endif - { - } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator() _NOEXCEPT {} // When _IsConst=false, this is the copy constructor. // It is non-trivial. Making it trivial would break ABI. @@ -913,7 +897,6 @@ public: return __x.__seg_ == __y.__seg_ && __x.__ctz_ == __y.__ctz_; } -#if _LIBCPP_STD_VER <= 17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 friend bool operator!=(const __bit_iterator& __x, const __bit_iterator& __y) { return !(__x == __y); @@ -938,18 +921,6 @@ public: operator>=(const __bit_iterator& __x, const __bit_iterator& __y) { return !(__x < __y); } -#else // _LIBCPP_STD_VER <= 17 - _LIBCPP_HIDE_FROM_ABI constexpr friend strong_ordering - operator<=>(const __bit_iterator& __x, const __bit_iterator& __y) { - if (__x.__seg_ < __y.__seg_) - return strong_ordering::less; - - if (__x.__seg_ == __y.__seg_) - return __x.__ctz_ <=> __y.__ctz_; - - return strong_ordering::greater; - } -#endif // _LIBCPP_STD_VER <= 17 private: _LIBCPP_HIDE_FROM_ABI diff --git a/libcxx/include/__cxx03/__chrono/duration.h b/libcxx/include/__cxx03/__chrono/duration.h index e5c4ca97e5743..01c75d7c1abaf 100644 --- a/libcxx/include/__cxx03/__chrono/duration.h +++ b/libcxx/include/__cxx03/__chrono/duration.h @@ -108,11 +108,6 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration duration_cast(const d template struct _LIBCPP_TEMPLATE_VIS treat_as_floating_point : is_floating_point<_Rep> {}; -#if _LIBCPP_STD_VER >= 17 -template -inline constexpr bool treat_as_floating_point_v = treat_as_floating_point<_Rep>::value; -#endif - template struct _LIBCPP_TEMPLATE_VIS duration_values { public: @@ -121,37 +116,6 @@ struct _LIBCPP_TEMPLATE_VIS duration_values { _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR _Rep min() _NOEXCEPT { return numeric_limits<_Rep>::lowest(); } }; -#if _LIBCPP_STD_VER >= 17 -template ::value, int> = 0> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration floor(const duration<_Rep, _Period>& __d) { - _ToDuration __t = chrono::duration_cast<_ToDuration>(__d); - if (__t > __d) - __t = __t - _ToDuration{1}; - return __t; -} - -template ::value, int> = 0> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration ceil(const duration<_Rep, _Period>& __d) { - _ToDuration __t = chrono::duration_cast<_ToDuration>(__d); - if (__t < __d) - __t = __t + _ToDuration{1}; - return __t; -} - -template ::value, int> = 0> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ToDuration round(const duration<_Rep, _Period>& __d) { - _ToDuration __lower = chrono::floor<_ToDuration>(__d); - _ToDuration __upper = __lower + _ToDuration{1}; - auto __lower_diff = __d - __lower; - auto __upper_diff = __upper - __d; - if (__lower_diff < __upper_diff) - return __lower; - if (__lower_diff > __upper_diff) - return __upper; - return __lower.count() & 1 ? __upper : __lower; -} -#endif - // duration template @@ -195,11 +159,7 @@ class _LIBCPP_TEMPLATE_VIS duration { rep __rep_; public: -#ifndef _LIBCPP_CXX03_LANG - constexpr duration() = default; -#else _LIBCPP_HIDE_FROM_ABI duration() {} -#endif template ::value && @@ -285,12 +245,7 @@ typedef duration milliseconds; typedef duration seconds; typedef duration< long, ratio< 60> > minutes; typedef duration< long, ratio<3600> > hours; -#if _LIBCPP_STD_VER >= 20 -typedef duration< int, ratio_multiply, hours::period>> days; -typedef duration< int, ratio_multiply, days::period>> weeks; -typedef duration< int, ratio_multiply, days::period>> years; -typedef duration< int, ratio_divide>> months; -#endif + // Duration == template @@ -314,8 +269,6 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period return __duration_eq, duration<_Rep2, _Period2> >()(__lhs, __rhs); } -#if _LIBCPP_STD_VER <= 17 - // Duration != template @@ -324,8 +277,6 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period return !(__lhs == __rhs); } -#endif // _LIBCPP_STD_VER <= 17 - // Duration < template @@ -373,18 +324,6 @@ operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period return !(__lhs < __rhs); } -#if _LIBCPP_STD_VER >= 20 - -template - requires three_way_comparable> -_LIBCPP_HIDE_FROM_ABI constexpr auto -operator<=>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { - using _Ct = common_type_t, duration<_Rep2, _Period2>>; - return _Ct(__lhs).count() <=> _Ct(__rhs).count(); -} - -#endif // _LIBCPP_STD_VER >= 20 - // Duration + template @@ -475,73 +414,11 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2 } // namespace chrono -#if _LIBCPP_STD_VER >= 14 -// Suffixes for duration literals [time.duration.literals] -inline namespace literals { -inline namespace chrono_literals { - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::hours operator""h(unsigned long long __h) { - return chrono::hours(static_cast(__h)); -} - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration> operator""h(long double __h) { - return chrono::duration>(__h); -} - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::minutes operator""min(unsigned long long __m) { - return chrono::minutes(static_cast(__m)); -} - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration> operator""min(long double __m) { - return chrono::duration>(__m); -} - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::seconds operator""s(unsigned long long __s) { - return chrono::seconds(static_cast(__s)); -} - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration operator""s(long double __s) { - return chrono::duration(__s); -} - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::milliseconds operator""ms(unsigned long long __ms) { - return chrono::milliseconds(static_cast(__ms)); -} - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration operator""ms(long double __ms) { - return chrono::duration(__ms); -} - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::microseconds operator""us(unsigned long long __us) { - return chrono::microseconds(static_cast(__us)); -} - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration operator""us(long double __us) { - return chrono::duration(__us); -} - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::nanoseconds operator""ns(unsigned long long __ns) { - return chrono::nanoseconds(static_cast(__ns)); -} - -_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration operator""ns(long double __ns) { - return chrono::duration(__ns); -} - -} // namespace chrono_literals -} // namespace literals - -namespace chrono { // hoist the literals into namespace std::chrono -using namespace literals::chrono_literals; -} // namespace chrono - -#endif // _LIBCPP_STD_VER >= 14 - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) # include <__cxx03/type_traits> #endif diff --git a/libcxx/include/__cxx03/__chrono/system_clock.h b/libcxx/include/__cxx03/__chrono/system_clock.h index 7ae053f3bb409..28cf3562036b1 100644 --- a/libcxx/include/__cxx03/__chrono/system_clock.h +++ b/libcxx/include/__cxx03/__chrono/system_clock.h @@ -36,15 +36,6 @@ class _LIBCPP_EXPORTED_FROM_ABI system_clock { static time_point from_time_t(time_t __t) _NOEXCEPT; }; -#if _LIBCPP_STD_VER >= 20 - -template -using sys_time = time_point; -using sys_seconds = sys_time; -using sys_days = sys_time; - -#endif - } // namespace chrono _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__cxx03/__chrono/time_point.h b/libcxx/include/__cxx03/__chrono/time_point.h index a7efb367807c7..cf0fbc28a8856 100644 --- a/libcxx/include/__cxx03/__chrono/time_point.h +++ b/libcxx/include/__cxx03/__chrono/time_point.h @@ -88,28 +88,6 @@ time_point_cast(const time_point<_Clock, _Duration>& __t) { return time_point<_Clock, _ToDuration>(chrono::duration_cast<_ToDuration>(__t.time_since_epoch())); } -#if _LIBCPP_STD_VER >= 17 -template ::value, int> = 0> -inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration> floor(const time_point<_Clock, _Duration>& __t) { - return time_point<_Clock, _ToDuration>{chrono::floor<_ToDuration>(__t.time_since_epoch())}; -} - -template ::value, int> = 0> -inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration> ceil(const time_point<_Clock, _Duration>& __t) { - return time_point<_Clock, _ToDuration>{chrono::ceil<_ToDuration>(__t.time_since_epoch())}; -} - -template ::value, int> = 0> -inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration> round(const time_point<_Clock, _Duration>& __t) { - return time_point<_Clock, _ToDuration>{chrono::round<_ToDuration>(__t.time_since_epoch())}; -} - -template ::is_signed, int> = 0> -inline _LIBCPP_HIDE_FROM_ABI constexpr duration<_Rep, _Period> abs(duration<_Rep, _Period> __d) { - return __d >= __d.zero() ? +__d : -__d; -} -#endif // _LIBCPP_STD_VER >= 17 - // time_point == template @@ -118,8 +96,6 @@ operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, return __lhs.time_since_epoch() == __rhs.time_since_epoch(); } -#if _LIBCPP_STD_VER <= 17 - // time_point != template @@ -128,8 +104,6 @@ operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, return !(__lhs == __rhs); } -#endif // _LIBCPP_STD_VER <= 17 - // time_point < template @@ -162,16 +136,6 @@ operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, return !(__lhs < __rhs); } -#if _LIBCPP_STD_VER >= 20 - -template _Duration2> -_LIBCPP_HIDE_FROM_ABI constexpr auto -operator<=>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) { - return __lhs.time_since_epoch() <=> __rhs.time_since_epoch(); -} - -#endif // _LIBCPP_STD_VER >= 20 - // time_point operator+(time_point x, duration y); template diff --git a/libcxx/include/__cxx03/__config b/libcxx/include/__cxx03/__config index 880d14a50a052..0172f76cef912 100644 --- a/libcxx/include/__cxx03/__config +++ b/libcxx/include/__cxx03/__config @@ -157,11 +157,6 @@ _LIBCPP_HARDENING_MODE_DEBUG # define _LIBCPP_TOSTRING2(x) #x # define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) -// NOLINTNEXTLINE(libcpp-cpp-version-check) -# if __cplusplus < 201103L -# define _LIBCPP_CXX03_LANG -# endif - # ifndef __has_constexpr_builtin # define __has_constexpr_builtin(x) 0 # endif @@ -307,18 +302,6 @@ _LIBCPP_HARDENING_MODE_DEBUG # define _LIBCPP_USING_DEV_RANDOM # endif -# ifndef _LIBCPP_CXX03_LANG - -# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp) -# define _ALIGNAS_TYPE(x) alignas(x) -# define _ALIGNAS(x) alignas(x) -# define _LIBCPP_NORETURN [[noreturn]] -# define _NOEXCEPT noexcept -# define _NOEXCEPT_(...) noexcept(__VA_ARGS__) -# define _LIBCPP_CONSTEXPR constexpr - -# else - # define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp) # define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) # define _ALIGNAS(x) __attribute__((__aligned__(x))) @@ -334,8 +317,6 @@ _LIBCPP_HARDENING_MODE_DEBUG typedef __char16_t char16_t; typedef __char32_t char32_t; -# endif - # define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) // Objective-C++ features (opt-in) @@ -613,7 +594,6 @@ typedef __char32_t char32_t; # define _LIBCPP_HAS_NO_INT128 # endif -# ifdef _LIBCPP_CXX03_LANG # define _LIBCPP_DECLARE_STRONG_ENUM(x) \ struct _LIBCPP_EXPORTED_FROM_ABI x { \ enum __lx @@ -626,11 +606,6 @@ typedef __char32_t char32_t; }; // clang-format on -# else // _LIBCPP_CXX03_LANG -# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class x -# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) -# endif // _LIBCPP_CXX03_LANG - # if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || defined(__NetBSD__) # define _LIBCPP_LOCALE__L_EXTENSIONS 1 # endif @@ -675,73 +650,29 @@ typedef __char32_t char32_t; # define _LIBCPP_WCTYPE_IS_MASK # endif -# if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t) -# define _LIBCPP_HAS_NO_CHAR8_T -# endif +# define _LIBCPP_HAS_NO_CHAR8_T // Deprecation macros. // // Deprecations warnings are always enabled, except when users explicitly opt-out // by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS. # if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) -# if __has_attribute(__deprecated__) -# define _LIBCPP_DEPRECATED __attribute__((__deprecated__)) -# define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m))) -# elif _LIBCPP_STD_VER >= 14 -# define _LIBCPP_DEPRECATED [[deprecated]] -# define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]] -# else -# define _LIBCPP_DEPRECATED -# define _LIBCPP_DEPRECATED_(m) -# endif +# define _LIBCPP_DEPRECATED __attribute__((__deprecated__)) +# define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m))) # else # define _LIBCPP_DEPRECATED # define _LIBCPP_DEPRECATED_(m) # endif -# if _LIBCPP_STD_VER < 20 -# define _LIBCPP_DEPRECATED_ATOMIC_SYNC \ - _LIBCPP_DEPRECATED_("The C++20 synchronization library has been deprecated prior to C++20. Please update to " \ - "using -std=c++20 if you need to use these facilities.") -# else -# define _LIBCPP_DEPRECATED_ATOMIC_SYNC /* nothing */ -# endif - -# if !defined(_LIBCPP_CXX03_LANG) -# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED -# else -# define _LIBCPP_DEPRECATED_IN_CXX11 -# endif +# define _LIBCPP_DEPRECATED_ATOMIC_SYNC /* nothing */ -# if _LIBCPP_STD_VER >= 14 -# define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED -# else -# define _LIBCPP_DEPRECATED_IN_CXX14 -# endif +# define _LIBCPP_DEPRECATED_IN_CXX11 -# if _LIBCPP_STD_VER >= 17 -# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED -# else -# define _LIBCPP_DEPRECATED_IN_CXX17 -# endif - -# if _LIBCPP_STD_VER >= 20 -# define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED -# else -# define _LIBCPP_DEPRECATED_IN_CXX20 -# endif - -# if _LIBCPP_STD_VER >= 23 -# define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED -# else -# define _LIBCPP_DEPRECATED_IN_CXX23 -# endif - -# if _LIBCPP_STD_VER >= 26 -# define _LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_DEPRECATED -# else -# define _LIBCPP_DEPRECATED_IN_CXX26 -# endif +# define _LIBCPP_DEPRECATED_IN_CXX14 +# define _LIBCPP_DEPRECATED_IN_CXX17 +# define _LIBCPP_DEPRECATED_IN_CXX20 +# define _LIBCPP_DEPRECATED_IN_CXX23 +# define _LIBCPP_DEPRECATED_IN_CXX26 # if !defined(_LIBCPP_HAS_NO_CHAR8_T) # define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED @@ -760,41 +691,12 @@ typedef __char32_t char32_t; # define _LIBCPP_SUPPRESS_DEPRECATED_POP # endif -# if _LIBCPP_STD_VER <= 11 -# define _LIBCPP_EXPLICIT_SINCE_CXX14 -# else -# define _LIBCPP_EXPLICIT_SINCE_CXX14 explicit -# endif - -# if _LIBCPP_STD_VER >= 23 -# define _LIBCPP_EXPLICIT_SINCE_CXX23 explicit -# else -# define _LIBCPP_EXPLICIT_SINCE_CXX23 -# endif - -# if _LIBCPP_STD_VER >= 14 -# define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr -# else -# define _LIBCPP_CONSTEXPR_SINCE_CXX14 -# endif - -# if _LIBCPP_STD_VER >= 17 -# define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr -# else -# define _LIBCPP_CONSTEXPR_SINCE_CXX17 -# endif - -# if _LIBCPP_STD_VER >= 20 -# define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr -# else -# define _LIBCPP_CONSTEXPR_SINCE_CXX20 -# endif - -# if _LIBCPP_STD_VER >= 23 -# define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr -# else -# define _LIBCPP_CONSTEXPR_SINCE_CXX23 -# endif +# define _LIBCPP_EXPLICIT_SINCE_CXX14 +# define _LIBCPP_EXPLICIT_SINCE_CXX23 +# define _LIBCPP_CONSTEXPR_SINCE_CXX14 +# define _LIBCPP_CONSTEXPR_SINCE_CXX17 +# define _LIBCPP_CONSTEXPR_SINCE_CXX20 +# define _LIBCPP_CONSTEXPR_SINCE_CXX23 # ifndef _LIBCPP_WEAK # define _LIBCPP_WEAK __attribute__((__weak__)) @@ -933,9 +835,7 @@ typedef __char32_t char32_t; # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) # endif -# if _LIBCPP_STD_VER >= 20 -# define _LIBCPP_CONSTINIT constinit -# elif __has_attribute(__require_constant_initialization__) +# if __has_attribute(__require_constant_initialization__) # define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__)) # else # define _LIBCPP_CONSTINIT @@ -1037,19 +937,7 @@ typedef __char32_t char32_t; // macro is used to mark them as such, which suppresses the // '-Wctad-maybe-unsupported' compiler warning when CTAD is used in user code // with these classes. -# if _LIBCPP_STD_VER >= 17 -# ifdef _LIBCPP_COMPILER_CLANG_BASED -# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \ - template \ - [[maybe_unused]] _ClassName(typename _Tag::__allow_ctad...)->_ClassName<_Tag...> -# else -# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(ClassName) \ - template \ - ClassName(typename _Tag::__allow_ctad...)->ClassName<_Tag...> -# endif -# else -# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") -# endif +# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") // TODO(varconst): currently, there are bugs in Clang's intrinsics when handling Objective-C++ `id`, so don't use // compiler intrinsics in the Objective-C++ mode. diff --git a/libcxx/include/__cxx03/__configuration/language.h b/libcxx/include/__cxx03/__configuration/language.h index 8fd09f4b22554..adc98a8dc9a1a 100644 --- a/libcxx/include/__cxx03/__configuration/language.h +++ b/libcxx/include/__cxx03/__configuration/language.h @@ -16,25 +16,6 @@ # pragma GCC system_header #endif -// NOLINTBEGIN(libcpp-cpp-version-check) -#ifdef __cplusplus -# if __cplusplus <= 201103L -# define _LIBCPP_STD_VER 11 -# elif __cplusplus <= 201402L -# define _LIBCPP_STD_VER 14 -# elif __cplusplus <= 201703L -# define _LIBCPP_STD_VER 17 -# elif __cplusplus <= 202002L -# define _LIBCPP_STD_VER 20 -# elif __cplusplus <= 202302L -# define _LIBCPP_STD_VER 23 -# else -// Expected release year of the next C++ standard -# define _LIBCPP_STD_VER 26 -# endif -#endif // __cplusplus -// NOLINTEND(libcpp-cpp-version-check) - #if !defined(__cpp_rtti) || __cpp_rtti < 199711L # define _LIBCPP_HAS_NO_RTTI #endif diff --git a/libcxx/include/__cxx03/__debug_utils/randomize_range.h b/libcxx/include/__cxx03/__debug_utils/randomize_range.h index 1baf4f5361ffd..dec21a01ce3fc 100644 --- a/libcxx/include/__cxx03/__debug_utils/randomize_range.h +++ b/libcxx/include/__cxx03/__debug_utils/randomize_range.h @@ -25,9 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __debug_randomize_range(_Iterator __first, _Sentinel __last) { #ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY -# ifdef _LIBCPP_CXX03_LANG -# error Support for unspecified stability is only for C++11 and higher -# endif +# error Support for unspecified stability is only for C++11 and higher if (!__libcpp_is_constant_evaluated()) std::__shuffle<_AlgPolicy>(__first, __last, __libcpp_debug_randomizer()); diff --git a/libcxx/include/__cxx03/__exception/operations.h b/libcxx/include/__cxx03/__exception/operations.h index 9049a0f313fae..da8abba56198e 100644 --- a/libcxx/include/__cxx03/__exception/operations.h +++ b/libcxx/include/__cxx03/__exception/operations.h @@ -17,13 +17,10 @@ #endif namespace std { // purposefully not using versioning namespace -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) || \ - defined(_LIBCPP_BUILDING_LIBRARY) using unexpected_handler = void (*)(); _LIBCPP_EXPORTED_FROM_ABI unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT; _LIBCPP_EXPORTED_FROM_ABI unexpected_handler get_unexpected() _NOEXCEPT; _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void unexpected(); -#endif using terminate_handler = void (*)(); _LIBCPP_EXPORTED_FROM_ABI terminate_handler set_terminate(terminate_handler) _NOEXCEPT; diff --git a/libcxx/include/__cxx03/__functional/binary_function.h b/libcxx/include/__cxx03/__functional/binary_function.h index cc247eacb8e37..61329bb7316c2 100644 --- a/libcxx/include/__cxx03/__functional/binary_function.h +++ b/libcxx/include/__cxx03/__functional/binary_function.h @@ -18,8 +18,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) - template struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binary_function { typedef _Arg1 first_argument_type; @@ -27,27 +25,18 @@ struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binary_function { typedef _Result result_type; }; -#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) - template struct __binary_function_keep_layout_base { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using first_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg1; using second_argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg2; using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result; -#endif }; -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template using __binary_function = binary_function<_Arg1, _Arg2, _Result>; _LIBCPP_DIAGNOSTIC_POP -#else -template -using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>; -#endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__cxx03/__functional/binary_negate.h b/libcxx/include/__cxx03/__functional/binary_negate.h index e2173d72dc404..aa9ef71ffd262 100644 --- a/libcxx/include/__cxx03/__functional/binary_negate.h +++ b/libcxx/include/__cxx03/__functional/binary_negate.h @@ -19,8 +19,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) - template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 binary_negate : public __binary_function(__pred); } -#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_BINARY_NEGATE_H diff --git a/libcxx/include/__cxx03/__functional/bind.h b/libcxx/include/__cxx03/__functional/bind.h index ce2f27ad7dbd8..17228448c6efb 100644 --- a/libcxx/include/__cxx03/__functional/bind.h +++ b/libcxx/include/__cxx03/__functional/bind.h @@ -30,22 +30,12 @@ template struct is_bind_expression : _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value, false_type, is_bind_expression<__remove_cvref_t<_Tp> > > {}; -#if _LIBCPP_STD_VER >= 17 -template -inline constexpr bool is_bind_expression_v = is_bind_expression<_Tp>::value; -#endif - template struct is_placeholder : _If< _IsSame<_Tp, __remove_cvref_t<_Tp> >::value, integral_constant, is_placeholder<__remove_cvref_t<_Tp> > > {}; -#if _LIBCPP_STD_VER >= 17 -template -inline constexpr int is_placeholder_v = is_placeholder<_Tp>::value; -#endif - namespace placeholders { template @@ -75,222 +65,6 @@ _LIBCPP_EXPORTED_FROM_ABI extern const __ph<10> _10; template struct is_placeholder > : public integral_constant {}; -#ifndef _LIBCPP_CXX03_LANG - -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& __mu(reference_wrapper<_Tp> __t, _Uj&) { - return __t.get(); -} - -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<_Ti&, _Uj...>::type -__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>) { - return __ti(std::forward<_Uj>(std::get<_Indx>(__uj))...); -} - -template ::value, int> = 0> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<_Ti&, _Uj...>::type -__mu(_Ti& __ti, tuple<_Uj...>& __uj) { - typedef typename __make_tuple_indices::type __indices; - return std::__mu_expand(__ti, __uj, __indices()); -} - -template -struct __mu_return2 {}; - -template -struct __mu_return2 { - typedef typename tuple_element::value - 1, _Uj>::type type; -}; - -template ::value, int> = 0> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 -typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type -__mu(_Ti&, _Uj& __uj) { - const size_t __indx = is_placeholder<_Ti>::value - 1; - return std::forward::type>(std::get<__indx>(__uj)); -} - -template ::value && is_placeholder<_Ti>::value == 0 && - !__is_reference_wrapper<_Ti>::value, - int> = 0> -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Ti& __mu(_Ti& __ti, _Uj&) { - return __ti; -} - -template -struct __mu_return_impl; - -template -struct __mu_return_invokable // false -{ - typedef __nat type; -}; - -template -struct __mu_return_invokable { - typedef typename __invoke_of<_Ti&, _Uj...>::type type; -}; - -template -struct __mu_return_impl<_Ti, false, true, false, tuple<_Uj...> > - : public __mu_return_invokable<__invokable<_Ti&, _Uj...>::value, _Ti, _Uj...> {}; - -template -struct __mu_return_impl<_Ti, false, false, true, _TupleUj> { - typedef typename tuple_element::value - 1, _TupleUj>::type&& type; -}; - -template -struct __mu_return_impl<_Ti, true, false, false, _TupleUj> { - typedef typename _Ti::type& type; -}; - -template -struct __mu_return_impl<_Ti, false, false, false, _TupleUj> { - typedef _Ti& type; -}; - -template -struct __mu_return - : public __mu_return_impl< - _Ti, - __is_reference_wrapper<_Ti>::value, - is_bind_expression<_Ti>::value, - 0 < is_placeholder<_Ti>::value && is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value, - _TupleUj> {}; - -template -struct __is_valid_bind_return { - static const bool value = false; -}; - -template -struct __is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj> { - static const bool value = __invokable<_Fp, typename __mu_return<_BoundArgs, _TupleUj>::type...>::value; -}; - -template -struct __is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj> { - static const bool value = __invokable<_Fp, typename __mu_return::type...>::value; -}; - -template ::value> -struct __bind_return; - -template -struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj, true> { - typedef typename __invoke_of< _Fp&, typename __mu_return< _BoundArgs, _TupleUj >::type... >::type type; -}; - -template -struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true> { - typedef typename __invoke_of< _Fp&, typename __mu_return< const _BoundArgs, _TupleUj >::type... >::type type; -}; - -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __bind_return<_Fp, _BoundArgs, _Args>::type -__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) { - return std::__invoke(__f, std::__mu(std::get<_Indx>(__bound_args), __args)...); -} - -template -class __bind : public __weak_result_type<__decay_t<_Fp> > { -protected: - using _Fd = __decay_t<_Fp>; - typedef tuple<__decay_t<_BoundArgs>...> _Td; - -private: - _Fd __f_; - _Td __bound_args_; - - typedef typename __make_tuple_indices::type __indices; - -public: - template < - class _Gp, - class... _BA, - __enable_if_t::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind>::value, - int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bind(_Gp&& __f, _BA&&... __bound_args) - : __f_(std::forward<_Gp>(__f)), __bound_args_(std::forward<_BA>(__bound_args)...) {} - - template - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type - operator()(_Args&&... __args) { - return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...)); - } - - template - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 - typename __bind_return >::type - operator()(_Args&&... __args) const { - return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...)); - } -}; - -template -struct is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {}; - -template -class __bind_r : public __bind<_Fp, _BoundArgs...> { - typedef __bind<_Fp, _BoundArgs...> base; - typedef typename base::_Fd _Fd; - typedef typename base::_Td _Td; - -public: - typedef _Rp result_type; - - template < - class _Gp, - class... _BA, - __enable_if_t::value && !is_same<__libcpp_remove_reference_t<_Gp>, __bind_r>::value, - int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bind_r(_Gp&& __f, _BA&&... __bound_args) - : base(std::forward<_Gp>(__f), std::forward<_BA>(__bound_args)...) {} - - template < - class... _Args, - __enable_if_t >::type, result_type>::value || - is_void<_Rp>::value, - int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 result_type operator()(_Args&&... __args) { - typedef __invoke_void_return_wrapper<_Rp> _Invoker; - return _Invoker::__call(static_cast(*this), std::forward<_Args>(__args)...); - } - - template >::type, - result_type>::value || - is_void<_Rp>::value, - int> = 0> - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 result_type operator()(_Args&&... __args) const { - typedef __invoke_void_return_wrapper<_Rp> _Invoker; - return _Invoker::__call(static_cast(*this), std::forward<_Args>(__args)...); - } -}; - -template -struct is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {}; - -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind<_Fp, _BoundArgs...> -bind(_Fp&& __f, _BoundArgs&&... __bound_args) { - typedef __bind<_Fp, _BoundArgs...> type; - return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...); -} - -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bind_r<_Rp, _Fp, _BoundArgs...> -bind(_Fp&& __f, _BoundArgs&&... __bound_args) { - typedef __bind_r<_Rp, _Fp, _BoundArgs...> type; - return type(std::forward<_Fp>(__f), std::forward<_BoundArgs>(__bound_args)...); -} - -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_BIND_H diff --git a/libcxx/include/__cxx03/__functional/binder1st.h b/libcxx/include/__cxx03/__functional/binder1st.h index 21c136ff16d8c..1a4a2ed81c04d 100644 --- a/libcxx/include/__cxx03/__functional/binder1st.h +++ b/libcxx/include/__cxx03/__functional/binder1st.h @@ -19,8 +19,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) - template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder1st : public __unary_function { @@ -47,8 +45,6 @@ bind1st(const _Operation& __op, const _Tp& __x) { return binder1st<_Operation>(__op, __x); } -#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_BINDER1ST_H diff --git a/libcxx/include/__cxx03/__functional/binder2nd.h b/libcxx/include/__cxx03/__functional/binder2nd.h index 397215b3d9e11..06600946e3e96 100644 --- a/libcxx/include/__cxx03/__functional/binder2nd.h +++ b/libcxx/include/__cxx03/__functional/binder2nd.h @@ -19,8 +19,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) - template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder2nd : public __unary_function { @@ -47,8 +45,6 @@ bind2nd(const _Operation& __op, const _Tp& __x) { return binder2nd<_Operation>(__op, __x); } -#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_BINDER2ND_H diff --git a/libcxx/include/__cxx03/__functional/hash.h b/libcxx/include/__cxx03/__functional/hash.h index 15473a8572435..b2c3bee1c75bf 100644 --- a/libcxx/include/__cxx03/__functional/hash.h +++ b/libcxx/include/__cxx03/__functional/hash.h @@ -504,39 +504,6 @@ struct _LIBCPP_TEMPLATE_VIS __enum_hash<_Tp, false> { template struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp> {}; -#if _LIBCPP_STD_VER >= 17 - -template <> -struct _LIBCPP_TEMPLATE_VIS hash : public __unary_function { - _LIBCPP_HIDE_FROM_ABI size_t operator()(nullptr_t) const _NOEXCEPT { return 662607004ull; } -}; -#endif - -#ifndef _LIBCPP_CXX03_LANG -template -using __check_hash_requirements _LIBCPP_NODEBUG = - integral_constant::value && is_move_constructible<_Hash>::value && - __invokable_r::value >; - -template > -using __has_enabled_hash _LIBCPP_NODEBUG = - integral_constant::value && is_default_constructible<_Hash>::value >; - -# if _LIBCPP_STD_VER >= 17 -template -using __enable_hash_helper_imp _LIBCPP_NODEBUG = _Type; - -template -using __enable_hash_helper _LIBCPP_NODEBUG = - __enable_hash_helper_imp<_Type, __enable_if_t<__all<__has_enabled_hash<_Keys>::value...>::value> >; -# else -template -using __enable_hash_helper _LIBCPP_NODEBUG = _Type; -# endif - -#endif // !_LIBCPP_CXX03_LANG - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_HASH_H diff --git a/libcxx/include/__cxx03/__functional/identity.h b/libcxx/include/__cxx03/__functional/identity.h index 61e5ebdb31e6e..6af22948a1f19 100644 --- a/libcxx/include/__cxx03/__functional/identity.h +++ b/libcxx/include/__cxx03/__functional/identity.h @@ -40,26 +40,6 @@ struct __is_identity > : true_type {}; template <> struct __is_identity > : true_type {}; -#if _LIBCPP_STD_VER >= 20 - -struct identity { - template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator()(_Tp&& __t) const noexcept { - return std::forward<_Tp>(__t); - } - - using is_transparent = void; -}; - -template <> -struct __is_identity : true_type {}; -template <> -struct __is_identity > : true_type {}; -template <> -struct __is_identity > : true_type {}; - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_IDENTITY_H diff --git a/libcxx/include/__cxx03/__functional/mem_fun_ref.h b/libcxx/include/__cxx03/__functional/mem_fun_ref.h index ef962231dc92b..7a15d19b32f7f 100644 --- a/libcxx/include/__cxx03/__functional/mem_fun_ref.h +++ b/libcxx/include/__cxx03/__functional/mem_fun_ref.h @@ -20,8 +20,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) - template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t : public __unary_function<_Tp*, _Sp> { _Sp (_Tp::*__p_)(); @@ -139,8 +137,6 @@ mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const) { return const_mem_fun1_ref_t<_Sp, _Tp, _Ap>(__f); } -#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_MEM_FUN_REF_H diff --git a/libcxx/include/__cxx03/__functional/operations.h b/libcxx/include/__cxx03/__functional/operations.h index ddbe71bdc8b68..9c40a198fee15 100644 --- a/libcxx/include/__cxx03/__functional/operations.h +++ b/libcxx/include/__cxx03/__functional/operations.h @@ -24,11 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD // Arithmetic operations -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS plus : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { @@ -45,24 +41,7 @@ inline const bool __desugars_to_v<__plus_tag, plus<_Tp>, _Tp, _Tp> = true; template inline const bool __desugars_to_v<__plus_tag, plus, _Tp, _Up> = true; -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS plus { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) + std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) + std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) + std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS minus : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { @@ -71,24 +50,7 @@ struct _LIBCPP_TEMPLATE_VIS minus : __binary_function<_Tp, _Tp, _Tp> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS minus { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) - std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) - std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) - std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS multiplies : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { @@ -97,24 +59,7 @@ struct _LIBCPP_TEMPLATE_VIS multiplies : __binary_function<_Tp, _Tp, _Tp> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS multiplies { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) * std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) * std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) * std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS divides : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { @@ -123,24 +68,7 @@ struct _LIBCPP_TEMPLATE_VIS divides : __binary_function<_Tp, _Tp, _Tp> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS divides { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) / std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) / std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) / std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS modulus : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { @@ -149,50 +77,16 @@ struct _LIBCPP_TEMPLATE_VIS modulus : __binary_function<_Tp, _Tp, _Tp> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS modulus { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) % std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) % std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) % std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 template -#else -template -#endif struct _LIBCPP_TEMPLATE_VIS negate : __unary_function<_Tp, _Tp> { typedef _Tp __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return -__x; } }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS negate { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const - noexcept(noexcept(-std::forward<_Tp>(__x))) // - -> decltype(-std::forward<_Tp>(__x)) { - return -std::forward<_Tp>(__x); - } - typedef void is_transparent; -}; -#endif - // Bitwise operations -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS bit_and : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { @@ -201,43 +95,7 @@ struct _LIBCPP_TEMPLATE_VIS bit_and : __binary_function<_Tp, _Tp, _Tp> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS bit_and { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) & - std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) & std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) & std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -struct _LIBCPP_TEMPLATE_VIS bit_not : __unary_function<_Tp, _Tp> { - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return ~__x; } -}; -_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_not); - -template <> -struct _LIBCPP_TEMPLATE_VIS bit_not { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const - noexcept(noexcept(~std::forward<_Tp>(__x))) // - -> decltype(~std::forward<_Tp>(__x)) { - return ~std::forward<_Tp>(__x); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS bit_or : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { @@ -246,24 +104,7 @@ struct _LIBCPP_TEMPLATE_VIS bit_or : __binary_function<_Tp, _Tp, _Tp> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS bit_or { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) | std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) | std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) | std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 template -#else -template -#endif struct _LIBCPP_TEMPLATE_VIS bit_xor : __binary_function<_Tp, _Tp, _Tp> { typedef _Tp __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const { @@ -272,26 +113,9 @@ struct _LIBCPP_TEMPLATE_VIS bit_xor : __binary_function<_Tp, _Tp, _Tp> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS bit_xor { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) ^ std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) ^ std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - // Comparison operations -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS equal_to : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const { @@ -300,19 +124,6 @@ struct _LIBCPP_TEMPLATE_VIS equal_to : __binary_function<_Tp, _Tp, bool> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS equal_to { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) == std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) == std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) == std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - // The non-transparent std::equal_to specialization is only equivalent to a raw equality // comparison when we don't perform an implicit conversion when calling it. template @@ -322,11 +133,7 @@ inline const bool __desugars_to_v<__equal_tag, equal_to<_Tp>, _Tp, _Tp> = true; template inline const bool __desugars_to_v<__equal_tag, equal_to, _Tp, _Up> = true; -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS not_equal_to : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const { @@ -335,24 +142,7 @@ struct _LIBCPP_TEMPLATE_VIS not_equal_to : __binary_function<_Tp, _Tp, bool> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS not_equal_to { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) != std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) != std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) != std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS less : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const { @@ -364,27 +154,7 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less); template inline const bool __desugars_to_v<__less_tag, less<_Tp>, _Tp, _Tp> = true; -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS less { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) < std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) < std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) < std::forward<_T2>(__u); - } - typedef void is_transparent; -}; - -template -inline const bool __desugars_to_v<__less_tag, less<>, _Tp, _Tp> = true; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS less_equal : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const { @@ -393,24 +163,7 @@ struct _LIBCPP_TEMPLATE_VIS less_equal : __binary_function<_Tp, _Tp, bool> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS less_equal { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) <= std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) <= std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) <= std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS greater_equal : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const { @@ -419,24 +172,7 @@ struct _LIBCPP_TEMPLATE_VIS greater_equal : __binary_function<_Tp, _Tp, bool> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS greater_equal { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) >= - std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) >= std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) >= std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS greater : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const { @@ -445,26 +181,9 @@ struct _LIBCPP_TEMPLATE_VIS greater : __binary_function<_Tp, _Tp, bool> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS greater { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) > std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) > std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) > std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - // Logical operations -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS logical_and : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const { @@ -473,48 +192,14 @@ struct _LIBCPP_TEMPLATE_VIS logical_and : __binary_function<_Tp, _Tp, bool> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS logical_and { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) && std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) && std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) && std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS logical_not : __unary_function<_Tp, bool> { typedef bool __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x) const { return !__x; } }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS logical_not { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const - noexcept(noexcept(!std::forward<_Tp>(__x))) // - -> decltype(!std::forward<_Tp>(__x)) { - return !std::forward<_Tp>(__x); - } - typedef void is_transparent; -}; -#endif - -#if _LIBCPP_STD_VER >= 14 -template -#else template -#endif struct _LIBCPP_TEMPLATE_VIS logical_or : __binary_function<_Tp, _Tp, bool> { typedef bool __result_type; // used by valarray _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const { @@ -523,19 +208,6 @@ struct _LIBCPP_TEMPLATE_VIS logical_or : __binary_function<_Tp, _Tp, bool> { }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or); -#if _LIBCPP_STD_VER >= 14 -template <> -struct _LIBCPP_TEMPLATE_VIS logical_or { - template - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) || std::forward<_T2>(__u))) // - -> decltype(std::forward<_T1>(__t) || std::forward<_T2>(__u)) { - return std::forward<_T1>(__t) || std::forward<_T2>(__u); - } - typedef void is_transparent; -}; -#endif - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_OPERATIONS_H diff --git a/libcxx/include/__cxx03/__functional/pointer_to_binary_function.h b/libcxx/include/__cxx03/__functional/pointer_to_binary_function.h index 72474255d7fe2..69ec2c8f8b801 100644 --- a/libcxx/include/__cxx03/__functional/pointer_to_binary_function.h +++ b/libcxx/include/__cxx03/__functional/pointer_to_binary_function.h @@ -19,8 +19,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) - template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function : public __binary_function<_Arg1, _Arg2, _Result> { @@ -37,8 +35,6 @@ ptr_fun(_Result (*__f)(_Arg1, _Arg2)) { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__f); } -#endif - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_POINTER_TO_BINARY_FUNCTION_H diff --git a/libcxx/include/__cxx03/__functional/pointer_to_unary_function.h b/libcxx/include/__cxx03/__functional/pointer_to_unary_function.h index 8540ad07f3ec0..217ce3ff6c957 100644 --- a/libcxx/include/__cxx03/__functional/pointer_to_unary_function.h +++ b/libcxx/include/__cxx03/__functional/pointer_to_unary_function.h @@ -19,8 +19,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) - template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function : public __unary_function<_Arg, _Result> { @@ -37,8 +35,6 @@ ptr_fun(_Result (*__f)(_Arg)) { return pointer_to_unary_function<_Arg, _Result>(__f); } -#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_POINTER_TO_UNARY_FUNCTION_H diff --git a/libcxx/include/__cxx03/__functional/reference_wrapper.h b/libcxx/include/__cxx03/__functional/reference_wrapper.h index 2e37464414e1b..a9da980749f32 100644 --- a/libcxx/include/__cxx03/__functional/reference_wrapper.h +++ b/libcxx/include/__cxx03/__functional/reference_wrapper.h @@ -56,70 +56,11 @@ class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp> { // invoke template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of::type - operator()(_ArgTypes&&... __args) const -#if _LIBCPP_STD_VER >= 17 - // Since is_nothrow_invocable requires C++17 LWG3764 is not backported - // to earlier versions. - noexcept(is_nothrow_invocable_v<_Tp&, _ArgTypes...>) -#endif - { + operator()(_ArgTypes&&... __args) const { return std::__invoke(get(), std::forward<_ArgTypes>(__args)...); } - -#if _LIBCPP_STD_VER >= 26 - - // [refwrap.comparisons], comparisons - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(reference_wrapper __x, reference_wrapper __y) - requires requires { - { __x.get() == __y.get() } -> __boolean_testable; - } - { - return __x.get() == __y.get(); - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(reference_wrapper __x, const _Tp& __y) - requires requires { - { __x.get() == __y } -> __boolean_testable; - } - { - return __x.get() == __y; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(reference_wrapper __x, reference_wrapper __y) - requires(!is_const_v<_Tp>) && requires { - { __x.get() == __y.get() } -> __boolean_testable; - } - { - return __x.get() == __y.get(); - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(reference_wrapper __x, reference_wrapper __y) - requires requires { std::__synth_three_way(__x.get(), __y.get()); } - { - return std::__synth_three_way(__x.get(), __y.get()); - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(reference_wrapper __x, const _Tp& __y) - requires requires { std::__synth_three_way(__x.get(), __y); } - { - return std::__synth_three_way(__x.get(), __y); - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(reference_wrapper __x, reference_wrapper __y) - requires(!is_const_v<_Tp>) && requires { std::__synth_three_way(__x.get(), __y.get()); } - { - return std::__synth_three_way(__x.get(), __y.get()); - } - -#endif // _LIBCPP_STD_VER >= 26 }; -#if _LIBCPP_STD_VER >= 17 -template -reference_wrapper(_Tp&) -> reference_wrapper<_Tp>; -#endif - template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper<_Tp> ref(_Tp& __t) _NOEXCEPT { return reference_wrapper<_Tp>(__t); diff --git a/libcxx/include/__cxx03/__functional/unary_function.h b/libcxx/include/__cxx03/__functional/unary_function.h index 45ba29ee2cac5..8bf305a4dfe9f 100644 --- a/libcxx/include/__cxx03/__functional/unary_function.h +++ b/libcxx/include/__cxx03/__functional/unary_function.h @@ -17,34 +17,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) - template struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 unary_function { typedef _Arg argument_type; typedef _Result result_type; }; -#endif // _LIBCPP_STD_VER <= 14 - template struct __unary_function_keep_layout_base { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg; using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result; -#endif }; -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") template using __unary_function = unary_function<_Arg, _Result>; _LIBCPP_DIAGNOSTIC_POP -#else -template -using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>; -#endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__cxx03/__functional/unary_negate.h b/libcxx/include/__cxx03/__functional/unary_negate.h index 4d527865f378c..87abbe88e0e75 100644 --- a/libcxx/include/__cxx03/__functional/unary_negate.h +++ b/libcxx/include/__cxx03/__functional/unary_negate.h @@ -19,8 +19,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) - template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate : public __unary_function { @@ -41,8 +39,6 @@ not1(const _Predicate& __pred) { return unary_negate<_Predicate>(__pred); } -#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_UNARY_NEGATE_H diff --git a/libcxx/include/__cxx03/__functional/weak_result_type.h b/libcxx/include/__cxx03/__functional/weak_result_type.h index 77c2f5f054915..e0f42e5aeb9b7 100644 --- a/libcxx/include/__cxx03/__functional/weak_result_type.h +++ b/libcxx/include/__cxx03/__functional/weak_result_type.h @@ -88,9 +88,7 @@ template ::value> struct __weak_result_type_imp // bool is true : public __maybe_derive_from_unary_function<_Tp>, public __maybe_derive_from_binary_function<_Tp> { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = typename _Tp::result_type; -#endif }; template @@ -104,23 +102,17 @@ struct __weak_result_type : public __weak_result_type_imp<_Tp> {}; template struct __weak_result_type<_Rp()> { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; -#endif }; template struct __weak_result_type<_Rp (&)()> { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; -#endif }; template struct __weak_result_type<_Rp (*)()> { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; -#endif }; // 1 argument case @@ -174,51 +166,37 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> : public __binary_fu template struct __weak_result_type<_Rp(_A1, _A2, _A3, _A4...)> { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; -#endif }; template struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)> { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; -#endif }; template struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)> { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; -#endif }; template struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)> { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; -#endif }; template struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const> { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; -#endif }; template struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile> { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; -#endif }; template struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> { -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) using result_type _LIBCPP_NODEBUG _LIBCPP_DEPRECATED_IN_CXX17 = _Rp; -#endif }; template diff --git a/libcxx/include/__cxx03/__fwd/array.h b/libcxx/include/__cxx03/__fwd/array.h index f2648a1986e27..aea35f29c6423 100644 --- a/libcxx/include/__cxx03/__fwd/array.h +++ b/libcxx/include/__cxx03/__fwd/array.h @@ -27,14 +27,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp& get(array<_Tp, _Size>&) template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT; -#ifndef _LIBCPP_CXX03_LANG -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp&& get(array<_Tp, _Size>&&) _NOEXCEPT; - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT; -#endif - template struct __is_std_array : false_type {}; diff --git a/libcxx/include/__cxx03/__fwd/complex.h b/libcxx/include/__cxx03/__fwd/complex.h index bb1ae20ab3bf8..0959f941affb7 100644 --- a/libcxx/include/__cxx03/__fwd/complex.h +++ b/libcxx/include/__cxx03/__fwd/complex.h @@ -21,22 +21,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD template class _LIBCPP_TEMPLATE_VIS complex; -#if _LIBCPP_STD_VER >= 26 - -template -_LIBCPP_HIDE_FROM_ABI constexpr _Tp& get(complex<_Tp>&) noexcept; - -template -_LIBCPP_HIDE_FROM_ABI constexpr _Tp&& get(complex<_Tp>&&) noexcept; - -template -_LIBCPP_HIDE_FROM_ABI constexpr const _Tp& get(const complex<_Tp>&) noexcept; - -template -_LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& get(const complex<_Tp>&&) noexcept; - -#endif // _LIBCPP_STD_VER >= 26 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FWD_COMPLEX_H diff --git a/libcxx/include/__cxx03/__fwd/pair.h b/libcxx/include/__cxx03/__fwd/pair.h index 092374b509606..56d5bae5a90f3 100644 --- a/libcxx/include/__cxx03/__fwd/pair.h +++ b/libcxx/include/__cxx03/__fwd/pair.h @@ -30,16 +30,6 @@ template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(const pair<_T1, _T2>&) _NOEXCEPT; -#ifndef _LIBCPP_CXX03_LANG -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(pair<_T1, _T2>&&) _NOEXCEPT; - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(const pair<_T1, _T2>&&) _NOEXCEPT; -#endif - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FWD_PAIR_H diff --git a/libcxx/include/__cxx03/__fwd/string.h b/libcxx/include/__cxx03/__fwd/string.h index 4f2569e44283b..c0da201f2cc38 100644 --- a/libcxx/include/__cxx03/__fwd/string.h +++ b/libcxx/include/__cxx03/__fwd/string.h @@ -54,28 +54,6 @@ using u8string = basic_string; using u16string = basic_string; using u32string = basic_string; -#if _LIBCPP_STD_VER >= 17 - -namespace pmr { -template > -using basic_string _LIBCPP_AVAILABILITY_PMR = std::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>; - -using string _LIBCPP_AVAILABILITY_PMR = basic_string; - -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -using wstring _LIBCPP_AVAILABILITY_PMR = basic_string; -# endif - -# ifndef _LIBCPP_HAS_NO_CHAR8_T -using u8string _LIBCPP_AVAILABILITY_PMR = basic_string; -# endif - -using u16string _LIBCPP_AVAILABILITY_PMR = basic_string; -using u32string _LIBCPP_AVAILABILITY_PMR = basic_string; -} // namespace pmr - -#endif // _LIBCPP_STD_VER >= 17 - // clang-format off template class _LIBCPP_PREFERRED_NAME(string) @@ -87,17 +65,6 @@ class _LIBCPP_PREFERRED_NAME(string) #endif _LIBCPP_PREFERRED_NAME(u16string) _LIBCPP_PREFERRED_NAME(u32string) -#if _LIBCPP_STD_VER >= 17 - _LIBCPP_PREFERRED_NAME(pmr::string) -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - _LIBCPP_PREFERRED_NAME(pmr::wstring) -# endif -# ifndef _LIBCPP_HAS_NO_CHAR8_T - _LIBCPP_PREFERRED_NAME(pmr::u8string) -# endif - _LIBCPP_PREFERRED_NAME(pmr::u16string) - _LIBCPP_PREFERRED_NAME(pmr::u32string) -#endif basic_string; // clang-format on diff --git a/libcxx/include/__cxx03/__fwd/tuple.h b/libcxx/include/__cxx03/__fwd/tuple.h index fed99583f199f..55b46eeb18930 100644 --- a/libcxx/include/__cxx03/__fwd/tuple.h +++ b/libcxx/include/__cxx03/__fwd/tuple.h @@ -21,32 +21,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD template struct _LIBCPP_TEMPLATE_VIS tuple_element; -#ifndef _LIBCPP_CXX03_LANG - -template -class _LIBCPP_TEMPLATE_VIS tuple; - -template -struct _LIBCPP_TEMPLATE_VIS tuple_size; - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(tuple<_Tp...>&) _NOEXCEPT; - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(const tuple<_Tp...>&) _NOEXCEPT; - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&& -get(tuple<_Tp...>&&) _NOEXCEPT; - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& -get(const tuple<_Tp...>&&) _NOEXCEPT; - -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FWD_TUPLE_H diff --git a/libcxx/include/__cxx03/__hash_table b/libcxx/include/__cxx03/__hash_table index a4eff8c654f11..6148a828dd2f8 100644 --- a/libcxx/include/__cxx03/__hash_table +++ b/libcxx/include/__cxx03/__hash_table @@ -108,23 +108,12 @@ struct __hash_node : public __hash_node_base< __rebind_pointer_t<_VoidPtr, __has // We allow starting the lifetime of nodes without initializing the value held by the node, // since that is handled by the hash table itself in order to be allocator-aware. -#ifndef _LIBCPP_CXX03_LANG - -private: - union { - _Tp __value_; - }; - -public: - _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; } -#else private: _ALIGNAS_TYPE(_Tp) char __buffer_[sizeof(_Tp)]; public: _LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return *std::__launder(reinterpret_cast<_Tp*>(&__buffer_)); } -#endif _LIBCPP_HIDE_FROM_ABI explicit __hash_node(__next_pointer __next, size_t __hash) : _Base(__next), __hash_(__hash) {} _LIBCPP_HIDE_FROM_ABI ~__hash_node() {} @@ -618,35 +607,14 @@ public: friend class __hash_map_node_destructor; }; -#if _LIBCPP_STD_VER >= 17 -template -struct __generic_container_node_destructor; - -template -struct __generic_container_node_destructor<__hash_node<_Tp, _VoidPtr>, _Alloc> : __hash_node_destructor<_Alloc> { - using __hash_node_destructor<_Alloc>::__hash_node_destructor; -}; -#endif - template struct __enforce_unordered_container_requirements { -#ifndef _LIBCPP_CXX03_LANG - static_assert(__check_hash_requirements<_Key, _Hash>::value, - "the specified hash does not meet the Hash requirements"); - static_assert(is_copy_constructible<_Equal>::value, "the specified comparator is required to be copy constructible"); -#endif typedef int type; }; template -#ifndef _LIBCPP_CXX03_LANG -_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Equal const&, _Key const&, _Key const&>::value, - "the specified comparator type does not provide a viable const call operator") -_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Hash const&, _Key const&>::value, - "the specified hash functor does not provide a viable const call operator") -#endif - typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type - __diagnose_unordered_container_requirements(int); +typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type +__diagnose_unordered_container_requirements(int); // This dummy overload is used so that the compiler won't emit a spurious // "no matching function for call to __diagnose_unordered_xxx" diagnostic @@ -848,27 +816,6 @@ public: return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x); } -#if _LIBCPP_STD_VER >= 17 - template - _LIBCPP_HIDE_FROM_ABI _InsertReturnType __node_handle_insert_unique(_NodeHandle&& __nh); - template - _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_unique(const_iterator __hint, _NodeHandle&& __nh); - template - _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_unique(_Table& __source); - - template - _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(_NodeHandle&& __nh); - template - _LIBCPP_HIDE_FROM_ABI iterator __node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh); - template - _LIBCPP_HIDE_FROM_ABI void __node_handle_merge_multi(_Table& __source); - - template - _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(key_type const& __key); - template - _LIBCPP_HIDE_FROM_ABI _NodeHandle __node_handle_extract(const_iterator __it); -#endif - _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI void __rehash_unique(size_type __n) { __rehash(__n); } _LIBCPP_HIDE_FROM_ABI void __rehash_multi(size_type __n) { __rehash(__n); } @@ -925,14 +872,10 @@ public: _LIBCPP_HIDE_FROM_ABI pair __equal_range_multi(const _Key& __k) const; _LIBCPP_HIDE_FROM_ABI void swap(__hash_table& __u) -#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_(__is_nothrow_swappable_v&& __is_nothrow_swappable_v && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value || __is_nothrow_swappable_v<__pointer_allocator>) && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)); -#else - _NOEXCEPT_(__is_nothrow_swappable_v&& __is_nothrow_swappable_v); -#endif _LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return max_size(); } _LIBCPP_HIDE_FROM_ABI size_type bucket_size(size_type __n) const; @@ -1097,10 +1040,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, const template __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() { -#if defined(_LIBCPP_CXX03_LANG) static_assert(is_copy_constructible::value, "Predicate must be copy-constructible."); static_assert(is_copy_constructible::value, "Hasher must be copy-constructible."); -#endif __deallocate_node(__p1_.first().__next_); } @@ -1579,104 +1520,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(const_iterator __ return __r; } -#if _LIBCPP_STD_VER >= 17 -template -template -_LIBCPP_HIDE_FROM_ABI _InsertReturnType -__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(_NodeHandle&& __nh) { - if (__nh.empty()) - return _InsertReturnType{end(), false, _NodeHandle()}; - pair __result = __node_insert_unique(__nh.__ptr_); - if (__result.second) - __nh.__release_ptr(); - return _InsertReturnType{__result.first, __result.second, std::move(__nh)}; -} - -template -template -_LIBCPP_HIDE_FROM_ABI typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator -__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_unique(const_iterator, _NodeHandle&& __nh) { - if (__nh.empty()) - return end(); - pair __result = __node_insert_unique(__nh.__ptr_); - if (__result.second) - __nh.__release_ptr(); - return __result.first; -} - -template -template -_LIBCPP_HIDE_FROM_ABI _NodeHandle -__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract(key_type const& __key) { - iterator __i = find(__key); - if (__i == end()) - return _NodeHandle(); - return __node_handle_extract<_NodeHandle>(__i); -} - -template -template -_LIBCPP_HIDE_FROM_ABI _NodeHandle __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_extract(const_iterator __p) { - allocator_type __alloc(__node_alloc()); - return _NodeHandle(remove(__p).release(), __alloc); -} - -template -template -_LIBCPP_HIDE_FROM_ABI void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_unique(_Table& __source) { - static_assert(is_same<__node, typename _Table::__node>::value, ""); - - for (typename _Table::iterator __it = __source.begin(); __it != __source.end();) { - __node_pointer __src_ptr = __it.__node_->__upcast(); - size_t __hash = hash_function()(__src_ptr->__get_value()); - __next_pointer __existing_node = __node_insert_unique_prepare(__hash, __src_ptr->__get_value()); - auto __prev_iter = __it++; - if (__existing_node == nullptr) { - (void)__source.remove(__prev_iter).release(); - __src_ptr->__hash_ = __hash; - __node_insert_unique_perform(__src_ptr); - } - } -} - -template -template -_LIBCPP_HIDE_FROM_ABI typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator -__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(_NodeHandle&& __nh) { - if (__nh.empty()) - return end(); - iterator __result = __node_insert_multi(__nh.__ptr_); - __nh.__release_ptr(); - return __result; -} - -template -template -_LIBCPP_HIDE_FROM_ABI typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator -__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_insert_multi(const_iterator __hint, _NodeHandle&& __nh) { - if (__nh.empty()) - return end(); - iterator __result = __node_insert_multi(__hint, __nh.__ptr_); - __nh.__release_ptr(); - return __result; -} - -template -template -_LIBCPP_HIDE_FROM_ABI void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_handle_merge_multi(_Table& __source) { - static_assert(is_same::value, ""); - - for (typename _Table::iterator __it = __source.begin(); __it != __source.end();) { - __node_pointer __src_ptr = __it.__node_->__upcast(); - size_t __src_hash = hash_function()(__src_ptr->__get_value()); - __next_pointer __pn = __node_insert_multi_prepare(__src_hash, __src_ptr->__get_value()); - (void)__source.remove(__it++).release(); - __src_ptr->__hash_ = __src_hash; - __node_insert_multi_perform(__src_ptr, __pn); - } -} -#endif // _LIBCPP_STD_VER >= 17 - template template void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __n) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { @@ -1981,15 +1824,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(const _Key& __k) c template void __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u) -#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_(__is_nothrow_swappable_v&& __is_nothrow_swappable_v && (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value || __is_nothrow_swappable_v<__pointer_allocator>) && - (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)) -#else - _NOEXCEPT_(__is_nothrow_swappable_v&& __is_nothrow_swappable_v) -#endif -{ + (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)) { _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR( __node_traits::propagate_on_container_swap::value || this->__node_alloc() == __u.__node_alloc(), "unordered container::swap: Either propagate_on_container_swap " diff --git a/libcxx/include/__cxx03/__iterator/access.h b/libcxx/include/__cxx03/__iterator/access.h index 2d61d4a879d4f..99ba9c4c73d08 100644 --- a/libcxx/include/__cxx03/__iterator/access.h +++ b/libcxx/include/__cxx03/__iterator/access.h @@ -29,45 +29,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* end(_Tp (&__array)[_Np]) _NOEXCEPT return __array + _Np; } -#if !defined(_LIBCPP_CXX03_LANG) - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(_Cp& __c) -> decltype(__c.begin()) { - return __c.begin(); -} - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto begin(const _Cp& __c) -> decltype(__c.begin()) { - return __c.begin(); -} - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(_Cp& __c) -> decltype(__c.end()) { - return __c.end(); -} - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(const _Cp& __c) -> decltype(__c.end()) { - return __c.end(); -} - -# if _LIBCPP_STD_VER >= 14 - -template -_LIBCPP_HIDE_FROM_ABI constexpr auto -cbegin(const _Cp& __c) noexcept(noexcept(std::begin(__c))) -> decltype(std::begin(__c)) { - return std::begin(__c); -} - -template -_LIBCPP_HIDE_FROM_ABI constexpr auto cend(const _Cp& __c) noexcept(noexcept(std::end(__c))) -> decltype(std::end(__c)) { - return std::end(__c); -} - -# endif - -#else // defined(_LIBCPP_CXX03_LANG) - template _LIBCPP_HIDE_FROM_ABI typename _Cp::iterator begin(_Cp& __c) { return __c.begin(); @@ -88,8 +49,6 @@ _LIBCPP_HIDE_FROM_ABI typename _Cp::const_iterator end(const _Cp& __c) { return __c.end(); } -#endif // !defined(_LIBCPP_CXX03_LANG) - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___ITERATOR_ACCESS_H diff --git a/libcxx/include/__cxx03/__iterator/advance.h b/libcxx/include/__cxx03/__iterator/advance.h index df85a4faf3fd2..4ebe868735649 100644 --- a/libcxx/include/__cxx03/__iterator/advance.h +++ b/libcxx/include/__cxx03/__iterator/advance.h @@ -67,133 +67,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 void advance(_InputIter& __i std::__advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category()); } -#if _LIBCPP_STD_VER >= 20 - -// [range.iter.op.advance] - -namespace ranges { -namespace __advance { - -struct __fn { -private: - template - _LIBCPP_HIDE_FROM_ABI static constexpr void __advance_forward(_Ip& __i, iter_difference_t<_Ip> __n) { - while (__n > 0) { - --__n; - ++__i; - } - } - - template - _LIBCPP_HIDE_FROM_ABI static constexpr void __advance_backward(_Ip& __i, iter_difference_t<_Ip> __n) { - while (__n < 0) { - ++__n; - --__i; - } - } - -public: - // Preconditions: If `I` does not model `bidirectional_iterator`, `n` is not negative. - template - _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Ip& __i, iter_difference_t<_Ip> __n) const { - // Calling `advance` with a negative value on a non-bidirectional iterator is a no-op in the current implementation. - _LIBCPP_ASSERT_PEDANTIC( - __n >= 0 || bidirectional_iterator<_Ip>, "If `n < 0`, then `bidirectional_iterator` must be true."); - - // If `I` models `random_access_iterator`, equivalent to `i += n`. - if constexpr (random_access_iterator<_Ip>) { - __i += __n; - return; - } else if constexpr (bidirectional_iterator<_Ip>) { - // Otherwise, if `n` is non-negative, increments `i` by `n`. - __advance_forward(__i, __n); - // Otherwise, decrements `i` by `-n`. - __advance_backward(__i, __n); - return; - } else { - // Otherwise, if `n` is non-negative, increments `i` by `n`. - __advance_forward(__i, __n); - return; - } - } - - // Preconditions: Either `assignable_from || sized_sentinel_for` is modeled, or [i, bound_sentinel) - // denotes a range. - template _Sp> - _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Ip& __i, _Sp __bound_sentinel) const { - // If `I` and `S` model `assignable_from`, equivalent to `i = std::move(bound_sentinel)`. - if constexpr (assignable_from<_Ip&, _Sp>) { - __i = std::move(__bound_sentinel); - } - // Otherwise, if `S` and `I` model `sized_sentinel_for`, equivalent to `ranges::advance(i, bound_sentinel - - // i)`. - else if constexpr (sized_sentinel_for<_Sp, _Ip>) { - (*this)(__i, __bound_sentinel - __i); - } - // Otherwise, while `bool(i != bound_sentinel)` is true, increments `i`. - else { - while (__i != __bound_sentinel) { - ++__i; - } - } - } - - // Preconditions: - // * If `n > 0`, [i, bound_sentinel) denotes a range. - // * If `n == 0`, [i, bound_sentinel) or [bound_sentinel, i) denotes a range. - // * If `n < 0`, [bound_sentinel, i) denotes a range, `I` models `bidirectional_iterator`, and `I` and `S` model - // `same_as`. - // Returns: `n - M`, where `M` is the difference between the ending and starting position. - template _Sp> - _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> - operator()(_Ip& __i, iter_difference_t<_Ip> __n, _Sp __bound_sentinel) const { - // Calling `advance` with a negative value on a non-bidirectional iterator is a no-op in the current implementation. - _LIBCPP_ASSERT_PEDANTIC((__n >= 0) || (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>), - "If `n < 0`, then `bidirectional_iterator && same_as` must be true."); - // If `S` and `I` model `sized_sentinel_for`: - if constexpr (sized_sentinel_for<_Sp, _Ip>) { - // If |n| >= |bound_sentinel - i|, equivalent to `ranges::advance(i, bound_sentinel)`. - // __magnitude_geq(a, b) returns |a| >= |b|, assuming they have the same sign. - auto __magnitude_geq = [](auto __a, auto __b) { return __a == 0 ? __b == 0 : __a > 0 ? __a >= __b : __a <= __b; }; - if (const auto __m = __bound_sentinel - __i; __magnitude_geq(__n, __m)) { - (*this)(__i, __bound_sentinel); - return __n - __m; - } - - // Otherwise, equivalent to `ranges::advance(i, n)`. - (*this)(__i, __n); - return 0; - } else { - // Otherwise, if `n` is non-negative, while `bool(i != bound_sentinel)` is true, increments `i` but at - // most `n` times. - while (__n > 0 && __i != __bound_sentinel) { - ++__i; - --__n; - } - - // Otherwise, while `bool(i != bound_sentinel)` is true, decrements `i` but at most `-n` times. - if constexpr (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>) { - while (__n < 0 && __i != __bound_sentinel) { - --__i; - ++__n; - } - } - return __n; - } - - __libcpp_unreachable(); - } -}; - -} // namespace __advance - -inline namespace __cpo { -inline constexpr auto advance = __advance::__fn{}; -} // namespace __cpo -} // namespace ranges - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__cxx03/__iterator/back_insert_iterator.h b/libcxx/include/__cxx03/__iterator/back_insert_iterator.h index 962639a2746bf..a67b6d5b82cc5 100644 --- a/libcxx/include/__cxx03/__iterator/back_insert_iterator.h +++ b/libcxx/include/__cxx03/__iterator/back_insert_iterator.h @@ -28,11 +28,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_SUPPRESS_DEPRECATED_PUSH template -class _LIBCPP_TEMPLATE_VIS back_insert_iterator -#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES) - : public iterator -#endif -{ +class _LIBCPP_TEMPLATE_VIS back_insert_iterator : public iterator { _LIBCPP_SUPPRESS_DEPRECATED_POP protected: @@ -41,11 +37,7 @@ class _LIBCPP_TEMPLATE_VIS back_insert_iterator public: typedef output_iterator_tag iterator_category; typedef void value_type; -#if _LIBCPP_STD_VER >= 20 - typedef ptrdiff_t difference_type; -#else typedef void difference_type; -#endif typedef void pointer; typedef void reference; typedef _Container container_type; @@ -57,13 +49,6 @@ class _LIBCPP_TEMPLATE_VIS back_insert_iterator container->push_back(__value); return *this; } -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& - operator=(typename _Container::value_type&& __value) { - container->push_back(std::move(__value)); - return *this; - } -#endif // _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator*() { return *this; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator& operator++() { return *this; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 back_insert_iterator operator++(int) { return *this; } diff --git a/libcxx/include/__cxx03/__iterator/bounded_iter.h b/libcxx/include/__cxx03/__iterator/bounded_iter.h index 9148a81b848ea..1e034fc5bbd72 100644 --- a/libcxx/include/__cxx03/__iterator/bounded_iter.h +++ b/libcxx/include/__cxx03/__iterator/bounded_iter.h @@ -52,9 +52,6 @@ struct __bounded_iter { using pointer = typename iterator_traits<_Iterator>::pointer; using reference = typename iterator_traits<_Iterator>::reference; using iterator_category = typename iterator_traits<_Iterator>::iterator_category; -#if _LIBCPP_STD_VER >= 20 - using iterator_concept = contiguous_iterator_tag; -#endif // Create a singular iterator. // @@ -202,12 +199,10 @@ struct __bounded_iter { return __x.__current_ == __y.__current_; } -#if _LIBCPP_STD_VER <= 17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR friend bool operator!=(__bounded_iter const& __x, __bounded_iter const& __y) _NOEXCEPT { return __x.__current_ != __y.__current_; } -#endif // TODO(mordante) disable these overloads in the LLVM 20 release. _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR friend bool @@ -227,23 +222,6 @@ struct __bounded_iter { return __x.__current_ >= __y.__current_; } -#if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI constexpr friend strong_ordering - operator<=>(__bounded_iter const& __x, __bounded_iter const& __y) noexcept { - if constexpr (three_way_comparable<_Iterator, strong_ordering>) { - return __x.__current_ <=> __y.__current_; - } else { - if (__x.__current_ < __y.__current_) - return strong_ordering::less; - - if (__x.__current_ == __y.__current_) - return strong_ordering::equal; - - return strong_ordering::greater; - } - } -#endif // _LIBCPP_STD_VER >= 20 - private: template friend struct pointer_traits; @@ -258,10 +236,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __bounded_iter<_It> __make_bounded_iter( return __bounded_iter<_It>(std::move(__it), std::move(__begin), std::move(__end)); } -#if _LIBCPP_STD_VER <= 17 template struct __libcpp_is_contiguous_iterator<__bounded_iter<_Iterator> > : true_type {}; -#endif template struct pointer_traits<__bounded_iter<_Iterator> > { diff --git a/libcxx/include/__cxx03/__iterator/cpp17_iterator_concepts.h b/libcxx/include/__cxx03/__iterator/cpp17_iterator_concepts.h index aed3527aee08a..ff6c76a359032 100644 --- a/libcxx/include/__cxx03/__iterator/cpp17_iterator_concepts.h +++ b/libcxx/include/__cxx03/__iterator/cpp17_iterator_concepts.h @@ -30,161 +30,12 @@ _LIBCPP_PUSH_MACROS #include <__cxx03/__undef_macros> -#if _LIBCPP_STD_VER >= 20 - -_LIBCPP_BEGIN_NAMESPACE_STD - -template -concept __cpp17_move_constructible = is_move_constructible_v<_Tp>; - -template -concept __cpp17_copy_constructible = __cpp17_move_constructible<_Tp> && is_copy_constructible_v<_Tp>; - -template -concept __cpp17_move_assignable = requires(_Tp __lhs, _Tp __rhs) { - { __lhs = std::move(__rhs) } -> same_as<_Tp&>; -}; - -template -concept __cpp17_copy_assignable = __cpp17_move_assignable<_Tp> && requires(_Tp __lhs, _Tp __rhs) { - { __lhs = __rhs } -> same_as<_Tp&>; - { __lhs = std::as_const(__rhs) } -> same_as<_Tp&>; -}; - -template -concept __cpp17_destructible = requires(_Tp __v) { __v.~_Tp(); }; - -template -concept __cpp17_equality_comparable = requires(_Tp __lhs, _Tp __rhs) { - { __lhs == __rhs } -> __boolean_testable; - { std::as_const(__lhs) == __rhs } -> __boolean_testable; - { __lhs == std::as_const(__rhs) } -> __boolean_testable; - { std::as_const(__lhs) == std::as_const(__rhs) } -> __boolean_testable; -}; - -template -concept __cpp17_default_constructible = is_default_constructible_v<_Tp>; - -template -concept __cpp17_iterator = - __cpp17_copy_constructible<_Iter> && __cpp17_copy_assignable<_Iter> && __cpp17_destructible<_Iter> && - (is_signed_v<__iter_diff_t<_Iter>> || is_void_v<__iter_diff_t<_Iter>>) && requires(_Iter __iter) { - { *__iter }; - { ++__iter } -> same_as<_Iter&>; - }; - -template -concept __cpp17_input_iterator = - __cpp17_iterator<_Iter> && __cpp17_equality_comparable<_Iter> && requires(_Iter __lhs, _Iter __rhs) { - { __lhs != __rhs } -> __boolean_testable; - { std::as_const(__lhs) != __rhs } -> __boolean_testable; - { __lhs != std::as_const(__rhs) } -> __boolean_testable; - { std::as_const(__lhs) != std::as_const(__rhs) } -> __boolean_testable; - - { *__lhs } -> same_as<__iter_reference<_Iter>>; - { *std::as_const(__lhs) } -> same_as<__iter_reference<_Iter>>; - - { ++__lhs } -> same_as<_Iter&>; - { (void)__lhs++ }; - { *__lhs++ }; - }; - -template -concept __cpp17_output_iterator = __cpp17_iterator<_Iter> && requires(_Iter __iter, _WriteTo __write) { - { *__iter = std::forward<_WriteTo>(__write) }; - { ++__iter } -> same_as<_Iter&>; - { __iter++ } -> convertible_to; - { *__iter++ = std::forward<_WriteTo>(__write) }; -}; - -template -concept __cpp17_forward_iterator = - __cpp17_input_iterator<_Iter> && __cpp17_default_constructible<_Iter> && requires(_Iter __iter) { - { __iter++ } -> convertible_to; - { *__iter++ } -> same_as<__iter_reference<_Iter>>; - }; - -template -concept __cpp17_bidirectional_iterator = __cpp17_forward_iterator<_Iter> && requires(_Iter __iter) { - { --__iter } -> same_as<_Iter&>; - { __iter-- } -> convertible_to; - { *__iter-- } -> same_as<__iter_reference<_Iter>>; -}; - -template -concept __cpp17_random_access_iterator = - __cpp17_bidirectional_iterator<_Iter> && requires(_Iter __iter, __iter_diff_t<_Iter> __n) { - { __iter += __n } -> same_as<_Iter&>; - - { __iter + __n } -> same_as<_Iter>; - { __n + __iter } -> same_as<_Iter>; - { std::as_const(__iter) + __n } -> same_as<_Iter>; - { __n + std::as_const(__iter) } -> same_as<_Iter>; - - { __iter -= __n } -> same_as<_Iter&>; - { __iter - __n } -> same_as<_Iter>; - { std::as_const(__iter) - __n } -> same_as<_Iter>; - - { __iter - __iter } -> same_as<__iter_diff_t<_Iter>>; - { std::as_const(__iter) - __iter } -> same_as<__iter_diff_t<_Iter>>; - { __iter - std::as_const(__iter) } -> same_as<__iter_diff_t<_Iter>>; - { std::as_const(__iter) - std::as_const(__iter) } -> same_as<__iter_diff_t<_Iter>>; - - { __iter[__n] } -> convertible_to<__iter_reference<_Iter>>; - { std::as_const(__iter)[__n] } -> convertible_to<__iter_reference<_Iter>>; - - { __iter < __iter } -> __boolean_testable; - { std::as_const(__iter) < __iter } -> __boolean_testable; - { __iter < std::as_const(__iter) } -> __boolean_testable; - { std::as_const(__iter) < std::as_const(__iter) } -> __boolean_testable; - - { __iter > __iter } -> __boolean_testable; - { std::as_const(__iter) > __iter } -> __boolean_testable; - { __iter > std::as_const(__iter) } -> __boolean_testable; - { std::as_const(__iter) > std::as_const(__iter) } -> __boolean_testable; - - { __iter >= __iter } -> __boolean_testable; - { std::as_const(__iter) >= __iter } -> __boolean_testable; - { __iter >= std::as_const(__iter) } -> __boolean_testable; - { std::as_const(__iter) >= std::as_const(__iter) } -> __boolean_testable; - - { __iter <= __iter } -> __boolean_testable; - { std::as_const(__iter) <= __iter } -> __boolean_testable; - { __iter <= std::as_const(__iter) } -> __boolean_testable; - { std::as_const(__iter) <= std::as_const(__iter) } -> __boolean_testable; - }; - -_LIBCPP_END_NAMESPACE_STD - -# ifndef _LIBCPP_DISABLE_ITERATOR_CHECKS -# define _LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR(iter_t, message) \ - static_assert(::std::__cpp17_input_iterator, message) -# define _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(iter_t, write_t, message) \ - static_assert(::std::__cpp17_output_iterator, message) -# define _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(iter_t, message) \ - static_assert(::std::__cpp17_forward_iterator, message) -# define _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(iter_t, message) \ - static_assert(::std::__cpp17_bidirectional_iterator, message) -# define _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(iter_t, message) \ - static_assert(::std::__cpp17_random_access_iterator, message) -# else -# define _LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR(iter_t, message) static_assert(true) -# define _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(iter_t, write_t, message) static_assert(true) -# define _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(iter_t, message) static_assert(true) -# define _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(iter_t, message) static_assert(true) -# define _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(iter_t, message) static_assert(true) -# endif - -#else // _LIBCPP_STD_VER >= 20 - # define _LIBCPP_REQUIRE_CPP17_INPUT_ITERATOR(iter_t, message) static_assert(true) # define _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(iter_t, write_t, message) static_assert(true) # define _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(iter_t, message) static_assert(true) # define _LIBCPP_REQUIRE_CPP17_BIDIRECTIONAL_ITERATOR(iter_t, message) static_assert(true) # define _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(iter_t, message) static_assert(true) -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_POP_MACROS #endif // _LIBCPP___CXX03___ITERATOR_CPP17_ITERATOR_CONCEPTS_H diff --git a/libcxx/include/__cxx03/__iterator/distance.h b/libcxx/include/__cxx03/__iterator/distance.h index f6b07228b363e..7b380d72eab0d 100644 --- a/libcxx/include/__cxx03/__iterator/distance.h +++ b/libcxx/include/__cxx03/__iterator/distance.h @@ -42,53 +42,6 @@ distance(_InputIter __first, _InputIter __last) { return std::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category()); } -#if _LIBCPP_STD_VER >= 20 - -// [range.iter.op.distance] - -namespace ranges { -namespace __distance { - -struct __fn { - template _Sp> - requires(!sized_sentinel_for<_Sp, _Ip>) - _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip __first, _Sp __last) const { - iter_difference_t<_Ip> __n = 0; - while (__first != __last) { - ++__first; - ++__n; - } - return __n; - } - - template > _Sp> - _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip&& __first, _Sp __last) const { - if constexpr (sized_sentinel_for<_Sp, __remove_cvref_t<_Ip>>) { - return __last - __first; - } else { - return __last - decay_t<_Ip>(__first); - } - } - - template - _LIBCPP_HIDE_FROM_ABI constexpr range_difference_t<_Rp> operator()(_Rp&& __r) const { - if constexpr (sized_range<_Rp>) { - return static_cast>(ranges::size(__r)); - } else { - return operator()(ranges::begin(__r), ranges::end(__r)); - } - } -}; - -} // namespace __distance - -inline namespace __cpo { -inline constexpr auto distance = __distance::__fn{}; -} // namespace __cpo -} // namespace ranges - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___ITERATOR_DISTANCE_H diff --git a/libcxx/include/__cxx03/__iterator/front_insert_iterator.h b/libcxx/include/__cxx03/__iterator/front_insert_iterator.h index 9c2b987806f5b..ca1edc31810d8 100644 --- a/libcxx/include/__cxx03/__iterator/front_insert_iterator.h +++ b/libcxx/include/__cxx03/__iterator/front_insert_iterator.h @@ -28,11 +28,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_SUPPRESS_DEPRECATED_PUSH template -class _LIBCPP_TEMPLATE_VIS front_insert_iterator -#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES) - : public iterator -#endif -{ +class _LIBCPP_TEMPLATE_VIS front_insert_iterator : public iterator { _LIBCPP_SUPPRESS_DEPRECATED_POP protected: @@ -41,11 +37,7 @@ class _LIBCPP_TEMPLATE_VIS front_insert_iterator public: typedef output_iterator_tag iterator_category; typedef void value_type; -#if _LIBCPP_STD_VER >= 20 - typedef ptrdiff_t difference_type; -#else typedef void difference_type; -#endif typedef void pointer; typedef void reference; typedef _Container container_type; @@ -57,13 +49,6 @@ class _LIBCPP_TEMPLATE_VIS front_insert_iterator container->push_front(__value); return *this; } -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& - operator=(typename _Container::value_type&& __value) { - container->push_front(std::move(__value)); - return *this; - } -#endif // _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator*() { return *this; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator& operator++() { return *this; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 front_insert_iterator operator++(int) { return *this; } diff --git a/libcxx/include/__cxx03/__iterator/insert_iterator.h b/libcxx/include/__cxx03/__iterator/insert_iterator.h index ca08efb0d6b97..3abeca0029bd6 100644 --- a/libcxx/include/__cxx03/__iterator/insert_iterator.h +++ b/libcxx/include/__cxx03/__iterator/insert_iterator.h @@ -26,21 +26,12 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 -template -using __insert_iterator_iter_t = ranges::iterator_t<_Container>; -#else template using __insert_iterator_iter_t = typename _Container::iterator; -#endif _LIBCPP_SUPPRESS_DEPRECATED_PUSH template -class _LIBCPP_TEMPLATE_VIS insert_iterator -#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES) - : public iterator -#endif -{ +class _LIBCPP_TEMPLATE_VIS insert_iterator : public iterator { _LIBCPP_SUPPRESS_DEPRECATED_POP protected: @@ -50,11 +41,7 @@ class _LIBCPP_TEMPLATE_VIS insert_iterator public: typedef output_iterator_tag iterator_category; typedef void value_type; -#if _LIBCPP_STD_VER >= 20 - typedef ptrdiff_t difference_type; -#else typedef void difference_type; -#endif typedef void pointer; typedef void reference; typedef _Container container_type; @@ -68,14 +55,6 @@ class _LIBCPP_TEMPLATE_VIS insert_iterator ++iter; return *this; } -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& - operator=(typename _Container::value_type&& __value) { - iter = container->insert(iter, std::move(__value)); - ++iter; - return *this; - } -#endif // _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator*() { return *this; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++() { return *this; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 insert_iterator& operator++(int) { return *this; } diff --git a/libcxx/include/__cxx03/__iterator/istream_iterator.h b/libcxx/include/__cxx03/__iterator/istream_iterator.h index bf45a1534e11d..35c5569558d6d 100644 --- a/libcxx/include/__cxx03/__iterator/istream_iterator.h +++ b/libcxx/include/__cxx03/__iterator/istream_iterator.h @@ -27,10 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_SUPPRESS_DEPRECATED_PUSH template , class _Distance = ptrdiff_t> class _LIBCPP_TEMPLATE_VIS istream_iterator -#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES) - : public iterator -#endif -{ + : public iterator { _LIBCPP_SUPPRESS_DEPRECATED_POP public: @@ -49,9 +46,6 @@ class _LIBCPP_TEMPLATE_VIS istream_iterator public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(nullptr), __value_() {} -#if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI constexpr istream_iterator(default_sentinel_t) : istream_iterator() {} -#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI istream_iterator(istream_type& __s) : __in_stream_(std::addressof(__s)) { if (!(*__in_stream_ >> __value_)) __in_stream_ = nullptr; @@ -73,12 +67,6 @@ class _LIBCPP_TEMPLATE_VIS istream_iterator template friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __x, const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __y); - -#if _LIBCPP_STD_VER >= 20 - friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator& __i, default_sentinel_t) { - return __i.__in_stream_ == nullptr; - } -#endif // _LIBCPP_STD_VER >= 20 }; template @@ -87,13 +75,11 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator<_Tp, _CharT, return __x.__in_stream_ == __y.__in_stream_; } -#if _LIBCPP_STD_VER <= 17 template inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x, const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y) { return !(__x == __y); } -#endif // _LIBCPP_STD_VER <= 17 _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__cxx03/__iterator/istreambuf_iterator.h b/libcxx/include/__cxx03/__iterator/istreambuf_iterator.h index 6ef2f4b529c00..b21e0bc927858 100644 --- a/libcxx/include/__cxx03/__iterator/istreambuf_iterator.h +++ b/libcxx/include/__cxx03/__iterator/istreambuf_iterator.h @@ -25,10 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_SUPPRESS_DEPRECATED_PUSH template class _LIBCPP_TEMPLATE_VIS istreambuf_iterator -#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES) - : public iterator -#endif -{ + : public iterator { _LIBCPP_SUPPRESS_DEPRECATED_POP public: @@ -64,9 +61,6 @@ class _LIBCPP_TEMPLATE_VIS istreambuf_iterator public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(nullptr) {} -#if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI constexpr istreambuf_iterator(default_sentinel_t) noexcept : istreambuf_iterator() {} -#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(istream_type& __s) _NOEXCEPT : __sbuf_(__s.rdbuf()) {} _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(streambuf_type* __s) _NOEXCEPT : __sbuf_(__s) {} _LIBCPP_HIDE_FROM_ABI istreambuf_iterator(const __proxy& __p) _NOEXCEPT : __sbuf_(__p.__sbuf_) {} @@ -81,12 +75,6 @@ class _LIBCPP_TEMPLATE_VIS istreambuf_iterator _LIBCPP_HIDE_FROM_ABI bool equal(const istreambuf_iterator& __b) const { return __test_for_eof() == __b.__test_for_eof(); } - -#if _LIBCPP_STD_VER >= 20 - friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istreambuf_iterator& __i, default_sentinel_t) { - return __i.__test_for_eof(); - } -#endif // _LIBCPP_STD_VER >= 20 }; template @@ -95,13 +83,11 @@ operator==(const istreambuf_iterator<_CharT, _Traits>& __a, const istreambuf_ite return __a.equal(__b); } -#if _LIBCPP_STD_VER <= 17 template inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, const istreambuf_iterator<_CharT, _Traits>& __b) { return !__a.equal(__b); } -#endif // _LIBCPP_STD_VER <= 17 _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__cxx03/__iterator/iterator_traits.h b/libcxx/include/__cxx03/__iterator/iterator_traits.h index 7e913a55bd28d..9b279115e3468 100644 --- a/libcxx/include/__cxx03/__iterator/iterator_traits.h +++ b/libcxx/include/__cxx03/__iterator/iterator_traits.h @@ -32,25 +32,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 - -template -using __with_reference = _Tp&; - -template -concept __can_reference = requires { typename __with_reference<_Tp>; }; - -template -concept __dereferenceable = requires(_Tp& __t) { - { *__t } -> __can_reference; // not required to be equality-preserving -}; - -// [iterator.traits] -template <__dereferenceable _Tp> -using iter_reference_t = decltype(*std::declval<_Tp&>()); - -#endif // _LIBCPP_STD_VER >= 20 - template struct _LIBCPP_TEMPLATE_VIS iterator_traits; @@ -59,9 +40,6 @@ struct _LIBCPP_TEMPLATE_VIS output_iterator_tag {}; struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {}; struct _LIBCPP_TEMPLATE_VIS bidirectional_iterator_tag : public forward_iterator_tag {}; struct _LIBCPP_TEMPLATE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {}; -#if _LIBCPP_STD_VER >= 20 -struct _LIBCPP_TEMPLATE_VIS contiguous_iterator_tag : public random_access_iterator_tag {}; -#endif template struct __iter_traits_cache { @@ -137,226 +115,6 @@ struct __has_iterator_concept { static const bool value = decltype(__test<_Tp>(nullptr))::value; }; -#if _LIBCPP_STD_VER >= 20 - -// The `cpp17-*-iterator` exposition-only concepts have very similar names to the `Cpp17*Iterator` named requirements -// from `[iterator.cpp17]`. To avoid confusion between the two, the exposition-only concepts have been banished to -// a "detail" namespace indicating they have a niche use-case. -namespace __iterator_traits_detail { -template -concept __cpp17_iterator = requires(_Ip __i) { - { *__i } -> __can_reference; - { ++__i } -> same_as<_Ip&>; - { *__i++ } -> __can_reference; -} && copyable<_Ip>; - -template -concept __cpp17_input_iterator = __cpp17_iterator<_Ip> && equality_comparable<_Ip> && requires(_Ip __i) { - typename incrementable_traits<_Ip>::difference_type; - typename indirectly_readable_traits<_Ip>::value_type; - typename common_reference_t&&, typename indirectly_readable_traits<_Ip>::value_type&>; - typename common_reference_t::value_type&>; - requires signed_integral::difference_type>; -}; - -template -concept __cpp17_forward_iterator = - __cpp17_input_iterator<_Ip> && constructible_from<_Ip> && is_reference_v> && - same_as>, typename indirectly_readable_traits<_Ip>::value_type> && - requires(_Ip __i) { - { __i++ } -> convertible_to<_Ip const&>; - { *__i++ } -> same_as>; - }; - -template -concept __cpp17_bidirectional_iterator = __cpp17_forward_iterator<_Ip> && requires(_Ip __i) { - { --__i } -> same_as<_Ip&>; - { __i-- } -> convertible_to<_Ip const&>; - { *__i-- } -> same_as>; -}; - -template -concept __cpp17_random_access_iterator = - __cpp17_bidirectional_iterator<_Ip> && totally_ordered<_Ip> && - requires(_Ip __i, typename incrementable_traits<_Ip>::difference_type __n) { - { __i += __n } -> same_as<_Ip&>; - { __i -= __n } -> same_as<_Ip&>; - { __i + __n } -> same_as<_Ip>; - { __n + __i } -> same_as<_Ip>; - { __i - __n } -> same_as<_Ip>; - { __i - __i } -> same_as; // NOLINT(misc-redundant-expression) ; This is llvm.org/PR54114 - { __i[__n] } -> convertible_to>; - }; -} // namespace __iterator_traits_detail - -template -concept __has_member_reference = requires { typename _Ip::reference; }; - -template -concept __has_member_pointer = requires { typename _Ip::pointer; }; - -template -concept __has_member_iterator_category = requires { typename _Ip::iterator_category; }; - -template -concept __specifies_members = requires { - typename _Ip::value_type; - typename _Ip::difference_type; - requires __has_member_reference<_Ip>; - requires __has_member_iterator_category<_Ip>; -}; - -template -struct __iterator_traits_member_pointer_or_void { - using type = void; -}; - -template <__has_member_pointer _Tp> -struct __iterator_traits_member_pointer_or_void<_Tp> { - using type = typename _Tp::pointer; -}; - -template -concept __cpp17_iterator_missing_members = !__specifies_members<_Tp> && __iterator_traits_detail::__cpp17_iterator<_Tp>; - -template -concept __cpp17_input_iterator_missing_members = - __cpp17_iterator_missing_members<_Tp> && __iterator_traits_detail::__cpp17_input_iterator<_Tp>; - -// Otherwise, `pointer` names `void`. -template -struct __iterator_traits_member_pointer_or_arrow_or_void { - using type = void; -}; - -// [iterator.traits]/3.2.1 -// If the qualified-id `I::pointer` is valid and denotes a type, `pointer` names that type. -template <__has_member_pointer _Ip> -struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> { - using type = typename _Ip::pointer; -}; - -// Otherwise, if `decltype(declval().operator->())` is well-formed, then `pointer` names that -// type. -template - requires requires(_Ip& __i) { __i.operator->(); } && (!__has_member_pointer<_Ip>) -struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> { - using type = decltype(std::declval<_Ip&>().operator->()); -}; - -// Otherwise, `reference` names `iter-reference-t`. -template -struct __iterator_traits_member_reference { - using type = iter_reference_t<_Ip>; -}; - -// [iterator.traits]/3.2.2 -// If the qualified-id `I::reference` is valid and denotes a type, `reference` names that type. -template <__has_member_reference _Ip> -struct __iterator_traits_member_reference<_Ip> { - using type = typename _Ip::reference; -}; - -// [iterator.traits]/3.2.3.4 -// input_iterator_tag -template -struct __deduce_iterator_category { - using type = input_iterator_tag; -}; - -// [iterator.traits]/3.2.3.1 -// `random_access_iterator_tag` if `I` satisfies `cpp17-random-access-iterator`, or otherwise -template <__iterator_traits_detail::__cpp17_random_access_iterator _Ip> -struct __deduce_iterator_category<_Ip> { - using type = random_access_iterator_tag; -}; - -// [iterator.traits]/3.2.3.2 -// `bidirectional_iterator_tag` if `I` satisfies `cpp17-bidirectional-iterator`, or otherwise -template <__iterator_traits_detail::__cpp17_bidirectional_iterator _Ip> -struct __deduce_iterator_category<_Ip> { - using type = bidirectional_iterator_tag; -}; - -// [iterator.traits]/3.2.3.3 -// `forward_iterator_tag` if `I` satisfies `cpp17-forward-iterator`, or otherwise -template <__iterator_traits_detail::__cpp17_forward_iterator _Ip> -struct __deduce_iterator_category<_Ip> { - using type = forward_iterator_tag; -}; - -template -struct __iterator_traits_iterator_category : __deduce_iterator_category<_Ip> {}; - -// [iterator.traits]/3.2.3 -// If the qualified-id `I::iterator-category` is valid and denotes a type, `iterator-category` names -// that type. -template <__has_member_iterator_category _Ip> -struct __iterator_traits_iterator_category<_Ip> { - using type = typename _Ip::iterator_category; -}; - -// otherwise, it names void. -template -struct __iterator_traits_difference_type { - using type = void; -}; - -// If the qualified-id `incrementable_traits::difference_type` is valid and denotes a type, then -// `difference_type` names that type; -template - requires requires { typename incrementable_traits<_Ip>::difference_type; } -struct __iterator_traits_difference_type<_Ip> { - using type = typename incrementable_traits<_Ip>::difference_type; -}; - -// [iterator.traits]/3.4 -// Otherwise, `iterator_traits` has no members by any of the above names. -template -struct __iterator_traits {}; - -// [iterator.traits]/3.1 -// If `I` has valid ([temp.deduct]) member types `difference-type`, `value-type`, `reference`, and -// `iterator-category`, then `iterator-traits` has the following publicly accessible members: -template <__specifies_members _Ip> -struct __iterator_traits<_Ip> { - using iterator_category = typename _Ip::iterator_category; - using value_type = typename _Ip::value_type; - using difference_type = typename _Ip::difference_type; - using pointer = typename __iterator_traits_member_pointer_or_void<_Ip>::type; - using reference = typename _Ip::reference; -}; - -// [iterator.traits]/3.2 -// Otherwise, if `I` satisfies the exposition-only concept `cpp17-input-iterator`, -// `iterator-traits` has the following publicly accessible members: -template <__cpp17_input_iterator_missing_members _Ip> -struct __iterator_traits<_Ip> { - using iterator_category = typename __iterator_traits_iterator_category<_Ip>::type; - using value_type = typename indirectly_readable_traits<_Ip>::value_type; - using difference_type = typename incrementable_traits<_Ip>::difference_type; - using pointer = typename __iterator_traits_member_pointer_or_arrow_or_void<_Ip>::type; - using reference = typename __iterator_traits_member_reference<_Ip>::type; -}; - -// Otherwise, if `I` satisfies the exposition-only concept `cpp17-iterator`, then -// `iterator_traits` has the following publicly accessible members: -template <__cpp17_iterator_missing_members _Ip> -struct __iterator_traits<_Ip> { - using iterator_category = output_iterator_tag; - using value_type = void; - using difference_type = typename __iterator_traits_difference_type<_Ip>::type; - using pointer = void; - using reference = void; -}; - -template -struct iterator_traits : __iterator_traits<_Ip> { - using __primary_template = iterator_traits; -}; - -#else // _LIBCPP_STD_VER >= 20 - template struct __iterator_traits {}; @@ -387,21 +145,14 @@ template struct _LIBCPP_TEMPLATE_VIS iterator_traits : __iterator_traits<_Iter, __has_iterator_typedefs<_Iter>::value> { using __primary_template = iterator_traits; }; -#endif // _LIBCPP_STD_VER >= 20 template -#if _LIBCPP_STD_VER >= 20 - requires is_object_v<_Tp> -#endif struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> { typedef ptrdiff_t difference_type; typedef __remove_cv_t<_Tp> value_type; typedef _Tp* pointer; typedef _Tp& reference; typedef random_access_iterator_tag iterator_category; -#if _LIBCPP_STD_VER >= 20 - typedef contiguous_iterator_tag iterator_concept; -#endif }; template >::value> @@ -436,15 +187,8 @@ using __has_random_access_iterator_category = __has_iterator_category_convertibl // Such iterators receive special "contiguous" optimizations in // std::copy and std::sort. // -#if _LIBCPP_STD_VER >= 20 -template -struct __libcpp_is_contiguous_iterator - : _Or< __has_iterator_category_convertible_to<_Tp, contiguous_iterator_tag>, - __has_iterator_concept_convertible_to<_Tp, contiguous_iterator_tag> > {}; -#else template struct __libcpp_is_contiguous_iterator : false_type {}; -#endif // Any native pointer which is an iterator is also a contiguous iterator. template @@ -497,22 +241,6 @@ using __iter_diff_t = typename iterator_traits<_Iter>::difference_type; template using __iter_reference = typename iterator_traits<_Iter>::reference; -#if _LIBCPP_STD_VER >= 20 - -// [readable.traits] - -// Let `RI` be `remove_cvref_t`. The type `iter_value_t` denotes -// `indirectly_readable_traits::value_type` if `iterator_traits` names a specialization -// generated from the primary template, and `iterator_traits::value_type` otherwise. -// This has to be in this file and not readable_traits.h to break the include cycle between the two. -template -using iter_value_t = - typename conditional_t<__is_primary_template > >::value, - indirectly_readable_traits >, - iterator_traits > >::value_type; - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___ITERATOR_ITERATOR_TRAITS_H diff --git a/libcxx/include/__cxx03/__iterator/move_iterator.h b/libcxx/include/__cxx03/__iterator/move_iterator.h index 4d84ca2656307..200fabd4291ae 100644 --- a/libcxx/include/__cxx03/__iterator/move_iterator.h +++ b/libcxx/include/__cxx03/__iterator/move_iterator.h @@ -32,57 +32,9 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 -template -struct __move_iter_category_base {}; - -template - requires requires { typename iterator_traits<_Iter>::iterator_category; } -struct __move_iter_category_base<_Iter> { - using iterator_category = - _If< derived_from::iterator_category, random_access_iterator_tag>, - random_access_iterator_tag, - typename iterator_traits<_Iter>::iterator_category >; -}; - -template -concept __move_iter_comparable = requires { - { std::declval() == std::declval<_Sent>() } -> convertible_to; -}; -#endif // _LIBCPP_STD_VER >= 20 - template -class _LIBCPP_TEMPLATE_VIS move_iterator -#if _LIBCPP_STD_VER >= 20 - : public __move_iter_category_base<_Iter> -#endif -{ -#if _LIBCPP_STD_VER >= 20 - -private: - _LIBCPP_HIDE_FROM_ABI static constexpr auto __get_iter_concept() { - if constexpr (random_access_iterator<_Iter>) { - return random_access_iterator_tag{}; - } else if constexpr (bidirectional_iterator<_Iter>) { - return bidirectional_iterator_tag{}; - } else if constexpr (forward_iterator<_Iter>) { - return forward_iterator_tag{}; - } else { - return input_iterator_tag{}; - } - } -#endif // _LIBCPP_STD_VER >= 20 - +class _LIBCPP_TEMPLATE_VIS move_iterator { public: -#if _LIBCPP_STD_VER >= 20 - using iterator_type = _Iter; - using iterator_concept = decltype(__get_iter_concept()); - // iterator_category is inherited and not always present - using value_type = iter_value_t<_Iter>; - using difference_type = iter_difference_t<_Iter>; - using pointer = _Iter; - using reference = iter_rvalue_reference_t<_Iter>; -#else typedef _Iter iterator_type; typedef _If< __has_random_access_iterator_category<_Iter>::value, random_access_iterator_tag, @@ -95,7 +47,6 @@ class _LIBCPP_TEMPLATE_VIS move_iterator typedef typename iterator_traits::reference __reference; typedef __conditional_t::value, __libcpp_remove_reference_t<__reference>&&, __reference> reference; -#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit move_iterator(_Iter __i) : __current_(std::move(__i)) {} @@ -108,40 +59,6 @@ class _LIBCPP_TEMPLATE_VIS move_iterator return __current_; } -#if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI constexpr move_iterator() - requires is_constructible_v<_Iter> - : __current_() {} - - template - requires(!_IsSame<_Up, _Iter>::value) && convertible_to - _LIBCPP_HIDE_FROM_ABI constexpr move_iterator(const move_iterator<_Up>& __u) : __current_(__u.base()) {} - - template - requires(!_IsSame<_Up, _Iter>::value) && convertible_to && assignable_from<_Iter&, const _Up&> - _LIBCPP_HIDE_FROM_ABI constexpr move_iterator& operator=(const move_iterator<_Up>& __u) { - __current_ = __u.base(); - return *this; - } - - _LIBCPP_HIDE_FROM_ABI constexpr const _Iter& base() const& noexcept { return __current_; } - _LIBCPP_HIDE_FROM_ABI constexpr _Iter base() && { return std::move(__current_); } - - _LIBCPP_HIDE_FROM_ABI constexpr reference operator*() const { return ranges::iter_move(__current_); } - _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](difference_type __n) const { - return ranges::iter_move(__current_ + __n); - } - - _LIBCPP_HIDE_FROM_ABI constexpr auto operator++(int) - requires forward_iterator<_Iter> - { - move_iterator __tmp(*this); - ++__current_; - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++__current_; } -#else _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator() : __current_() {} template ::value && is_convertible::value, int> = 0> @@ -171,7 +88,6 @@ class _LIBCPP_TEMPLATE_VIS move_iterator ++__current_; return __tmp; } -#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator--() { --__current_; @@ -197,39 +113,6 @@ class _LIBCPP_TEMPLATE_VIS move_iterator return *this; } -#if _LIBCPP_STD_VER >= 20 - template _Sent> - friend _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const move_iterator& __x, const move_sentinel<_Sent>& __y) - requires __move_iter_comparable<_Iter, _Sent> - { - return __x.base() == __y.base(); - } - - template _Sent> - friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> - operator-(const move_sentinel<_Sent>& __x, const move_iterator& __y) { - return __x.base() - __y.base(); - } - - template _Sent> - friend _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Iter> - operator-(const move_iterator& __x, const move_sentinel<_Sent>& __y) { - return __x.base() - __y.base(); - } - - friend _LIBCPP_HIDE_FROM_ABI constexpr iter_rvalue_reference_t<_Iter> - iter_move(const move_iterator& __i) noexcept(noexcept(ranges::iter_move(__i.__current_))) { - return ranges::iter_move(__i.__current_); - } - - template _It2> - friend _LIBCPP_HIDE_FROM_ABI constexpr void - iter_swap(const move_iterator& __x, - const move_iterator<_It2>& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) { - return ranges::iter_swap(__x.__current_, __y.__current_); - } -#endif // _LIBCPP_STD_VER >= 20 - private: template friend class move_iterator; @@ -244,13 +127,11 @@ operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { return __x.base() == __y.base(); } -#if _LIBCPP_STD_VER <= 17 template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { return __x.base() != __y.base(); } -#endif // _LIBCPP_STD_VER <= 17 template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool @@ -276,52 +157,17 @@ operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { return __x.base() >= __y.base(); } -#if _LIBCPP_STD_VER >= 20 -template _Iter2> -inline _LIBCPP_HIDE_FROM_ABI constexpr auto -operator<=>(const move_iterator<_Iter1>& __x, - const move_iterator<_Iter2>& __y) -> compare_three_way_result_t<_Iter1, _Iter2> { - return __x.base() <=> __y.base(); -} -#endif // _LIBCPP_STD_VER >= 20 - -#ifndef _LIBCPP_CXX03_LANG -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto -operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) -> decltype(__x.base() - __y.base()) { - return __x.base() - __y.base(); -} -#else template inline _LIBCPP_HIDE_FROM_ABI typename move_iterator<_Iter1>::difference_type operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { return __x.base() - __y.base(); } -#endif // !_LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER >= 20 -template -inline _LIBCPP_HIDE_FROM_ABI constexpr move_iterator<_Iter> -operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x) - requires requires { - { __x.base() + __n } -> same_as<_Iter>; - } -{ - return __x + __n; -} -#else template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter> operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) { return move_iterator<_Iter>(__x.base() + __n); } -#endif // _LIBCPP_STD_VER >= 20 - -#if _LIBCPP_STD_VER >= 20 -template - requires(!sized_sentinel_for<_Iter1, _Iter2>) -inline constexpr bool disable_sized_sentinel_for, move_iterator<_Iter2>> = true; -#endif // _LIBCPP_STD_VER >= 20 template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator<_Iter> make_move_iterator(_Iter __i) { diff --git a/libcxx/include/__cxx03/__iterator/next.h b/libcxx/include/__cxx03/__iterator/next.h index 2b4f03e94dd3c..6ee32a433277f 100644 --- a/libcxx/include/__cxx03/__iterator/next.h +++ b/libcxx/include/__cxx03/__iterator/next.h @@ -34,48 +34,6 @@ next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = return __x; } -#if _LIBCPP_STD_VER >= 20 - -// [range.iter.op.next] - -namespace ranges { -namespace __next { - -struct __fn { - template - _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const { - ++__x; - return __x; - } - - template - _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const { - ranges::advance(__x, __n); - return __x; - } - - template _Sp> - _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, _Sp __bound_sentinel) const { - ranges::advance(__x, __bound_sentinel); - return __x; - } - - template _Sp> - _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n, _Sp __bound_sentinel) const { - ranges::advance(__x, __n, __bound_sentinel); - return __x; - } -}; - -} // namespace __next - -inline namespace __cpo { -inline constexpr auto next = __next::__fn{}; -} // namespace __cpo -} // namespace ranges - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___ITERATOR_NEXT_H diff --git a/libcxx/include/__cxx03/__iterator/ostream_iterator.h b/libcxx/include/__cxx03/__iterator/ostream_iterator.h index 100cc54045bb3..3e00ce2e69f26 100644 --- a/libcxx/include/__cxx03/__iterator/ostream_iterator.h +++ b/libcxx/include/__cxx03/__iterator/ostream_iterator.h @@ -26,21 +26,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_SUPPRESS_DEPRECATED_PUSH template > -class _LIBCPP_TEMPLATE_VIS ostream_iterator -#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES) - : public iterator -#endif -{ +class _LIBCPP_TEMPLATE_VIS ostream_iterator : public iterator { _LIBCPP_SUPPRESS_DEPRECATED_POP public: typedef output_iterator_tag iterator_category; typedef void value_type; -#if _LIBCPP_STD_VER >= 20 - typedef ptrdiff_t difference_type; -#else typedef void difference_type; -#endif typedef void pointer; typedef void reference; typedef _CharT char_type; diff --git a/libcxx/include/__cxx03/__iterator/ostreambuf_iterator.h b/libcxx/include/__cxx03/__iterator/ostreambuf_iterator.h index b5472b33b7711..27c8152a5400d 100644 --- a/libcxx/include/__cxx03/__iterator/ostreambuf_iterator.h +++ b/libcxx/include/__cxx03/__iterator/ostreambuf_iterator.h @@ -24,21 +24,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_SUPPRESS_DEPRECATED_PUSH template -class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator -#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES) - : public iterator -#endif -{ +class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator : public iterator { _LIBCPP_SUPPRESS_DEPRECATED_POP public: typedef output_iterator_tag iterator_category; typedef void value_type; -#if _LIBCPP_STD_VER >= 20 - typedef ptrdiff_t difference_type; -#else typedef void difference_type; -#endif typedef void pointer; typedef void reference; typedef _CharT char_type; diff --git a/libcxx/include/__cxx03/__iterator/prev.h b/libcxx/include/__cxx03/__iterator/prev.h index 2921971b88a30..82b2ef67a73fa 100644 --- a/libcxx/include/__cxx03/__iterator/prev.h +++ b/libcxx/include/__cxx03/__iterator/prev.h @@ -33,42 +33,6 @@ prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = return __x; } -#if _LIBCPP_STD_VER >= 20 - -// [range.iter.op.prev] - -namespace ranges { -namespace __prev { - -struct __fn { - template - _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const { - --__x; - return __x; - } - - template - _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const { - ranges::advance(__x, -__n); - return __x; - } - - template - _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n, _Ip __bound_iter) const { - ranges::advance(__x, -__n, __bound_iter); - return __x; - } -}; - -} // namespace __prev - -inline namespace __cpo { -inline constexpr auto prev = __prev::__fn{}; -} // namespace __cpo -} // namespace ranges - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___ITERATOR_PREV_H diff --git a/libcxx/include/__cxx03/__iterator/reverse_iterator.h b/libcxx/include/__cxx03/__iterator/reverse_iterator.h index 9c4d7a8a9b2ed..a7037003dafee 100644 --- a/libcxx/include/__cxx03/__iterator/reverse_iterator.h +++ b/libcxx/include/__cxx03/__iterator/reverse_iterator.h @@ -38,14 +38,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_SUPPRESS_DEPRECATED_PUSH template class _LIBCPP_TEMPLATE_VIS reverse_iterator -#if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES) : public iterator::iterator_category, typename iterator_traits<_Iter>::value_type, typename iterator_traits<_Iter>::difference_type, typename iterator_traits<_Iter>::pointer, - typename iterator_traits<_Iter>::reference> -#endif -{ + typename iterator_traits<_Iter>::reference> { _LIBCPP_SUPPRESS_DEPRECATED_POP private: @@ -53,11 +50,6 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator _Iter __t_; // no longer used as of LWG #2360, not removed due to ABI break #endif -#if _LIBCPP_STD_VER >= 20 - static_assert(__has_bidirectional_iterator_category<_Iter>::value || bidirectional_iterator<_Iter>, - "reverse_iterator requires It to be a bidirectional iterator."); -#endif // _LIBCPP_STD_VER >= 20 - protected: _Iter current; @@ -68,17 +60,10 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator _If<__has_random_access_iterator_category<_Iter>::value, random_access_iterator_tag, typename iterator_traits<_Iter>::iterator_category>; - using pointer = typename iterator_traits<_Iter>::pointer; -#if _LIBCPP_STD_VER >= 20 - using iterator_concept = _If, random_access_iterator_tag, bidirectional_iterator_tag>; - using value_type = iter_value_t<_Iter>; - using difference_type = iter_difference_t<_Iter>; - using reference = iter_reference_t<_Iter>; -#else + using pointer = typename iterator_traits<_Iter>::pointer; using value_type = typename iterator_traits<_Iter>::value_type; using difference_type = typename iterator_traits<_Iter>::difference_type; using reference = typename iterator_traits<_Iter>::reference; -#endif #ifndef _LIBCPP_ABI_NO_ITERATOR_BASES _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator() : __t_(), current() {} @@ -121,19 +106,7 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator return *--__tmp; } -#if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI constexpr pointer operator->() const - requires is_pointer_v<_Iter> || requires(const _Iter __i) { __i.operator->(); } - { - if constexpr (is_pointer_v<_Iter>) { - return std::prev(current); - } else { - return std::prev(current).operator->(); - } - } -#else _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pointer operator->() const { return std::addressof(operator*()); } -#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator++() { --current; @@ -170,120 +143,49 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](difference_type __n) const { return *(*this + __n); } - -#if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i) noexcept( - is_nothrow_copy_constructible_v<_Iter> && noexcept(ranges::iter_move(--std::declval<_Iter&>()))) { - auto __tmp = __i.base(); - return ranges::iter_move(--__tmp); - } - - template _Iter2> - _LIBCPP_HIDE_FROM_ABI friend constexpr void - iter_swap(const reverse_iterator& __x, const reverse_iterator<_Iter2>& __y) noexcept( - is_nothrow_copy_constructible_v<_Iter> && is_nothrow_copy_constructible_v<_Iter2> && - noexcept(ranges::iter_swap(--std::declval<_Iter&>(), --std::declval<_Iter2&>()))) { - auto __xtmp = __x.base(); - auto __ytmp = __y.base(); - ranges::iter_swap(--__xtmp, --__ytmp); - } -#endif // _LIBCPP_STD_VER >= 20 }; template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool -operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER >= 20 - requires requires { - { __x.base() == __y.base() } -> convertible_to; - } -#endif // _LIBCPP_STD_VER >= 20 -{ +operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() == __y.base(); } template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool -operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER >= 20 - requires requires { - { __x.base() > __y.base() } -> convertible_to; - } -#endif // _LIBCPP_STD_VER >= 20 -{ +operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() > __y.base(); } template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool -operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER >= 20 - requires requires { - { __x.base() != __y.base() } -> convertible_to; - } -#endif // _LIBCPP_STD_VER >= 20 -{ +operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() != __y.base(); } template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool -operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER >= 20 - requires requires { - { __x.base() < __y.base() } -> convertible_to; - } -#endif // _LIBCPP_STD_VER >= 20 -{ +operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() < __y.base(); } template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool -operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER >= 20 - requires requires { - { __x.base() <= __y.base() } -> convertible_to; - } -#endif // _LIBCPP_STD_VER >= 20 -{ +operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() <= __y.base(); } template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 bool -operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER >= 20 - requires requires { - { __x.base() >= __y.base() } -> convertible_to; - } -#endif // _LIBCPP_STD_VER >= 20 -{ +operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() >= __y.base(); } -#if _LIBCPP_STD_VER >= 20 -template _Iter2> -_LIBCPP_HIDE_FROM_ABI constexpr compare_three_way_result_t<_Iter1, _Iter2> -operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { - return __y.base() <=> __x.base(); -} -#endif // _LIBCPP_STD_VER >= 20 - -#ifndef _LIBCPP_CXX03_LANG -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto -operator-(const reverse_iterator<_Iter1>& __x, - const reverse_iterator<_Iter2>& __y) -> decltype(__y.base() - __x.base()) { - return __y.base() - __x.base(); -} -#else template inline _LIBCPP_HIDE_FROM_ABI typename reverse_iterator<_Iter1>::difference_type operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __y.base() - __x.base(); } -#endif template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter> @@ -291,29 +193,6 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i return reverse_iterator<_Iter>(__x.base() - __n); } -#if _LIBCPP_STD_VER >= 20 -template - requires(!sized_sentinel_for<_Iter1, _Iter2>) -inline constexpr bool disable_sized_sentinel_for, reverse_iterator<_Iter2>> = true; -#endif // _LIBCPP_STD_VER >= 20 - -#if _LIBCPP_STD_VER >= 14 -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) { - return reverse_iterator<_Iter>(__i); -} -#endif - -#if _LIBCPP_STD_VER >= 20 -template -_LIBCPP_HIDE_FROM_ABI constexpr ranges::subrange>, - reverse_iterator>> -__reverse_range(_Range&& __range) { - auto __first = ranges::begin(__range); - return {std::make_reverse_iterator(ranges::next(__first, ranges::end(__range))), std::make_reverse_iterator(__first)}; -} -#endif - template struct __unwrap_iter_impl >, __b> { using _UnwrappedIter = decltype(__unwrap_iter_impl<_Iter>::__unwrap(std::declval<_Iter>())); diff --git a/libcxx/include/__cxx03/__iterator/wrap_iter.h b/libcxx/include/__cxx03/__iterator/wrap_iter.h index a184372050c11..13d7e27f37698 100644 --- a/libcxx/include/__cxx03/__iterator/wrap_iter.h +++ b/libcxx/include/__cxx03/__iterator/wrap_iter.h @@ -33,9 +33,6 @@ class __wrap_iter { typedef typename iterator_traits::pointer pointer; typedef typename iterator_traits::reference reference; typedef typename iterator_traits::iterator_category iterator_category; -#if _LIBCPP_STD_VER >= 20 - typedef contiguous_iterator_tag iterator_concept; -#endif private: iterator_type __i_; @@ -131,7 +128,6 @@ operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC return __x.base() < __y.base(); } -#if _LIBCPP_STD_VER <= 17 template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT { @@ -143,7 +139,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { return !(__x == __y); } -#endif // TODO(mordante) disable these overloads in the LLVM 20 release. template @@ -182,35 +177,9 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX return !(__y < __x); } -#if _LIBCPP_STD_VER >= 20 template -_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering -operator<=>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept { - if constexpr (three_way_comparable_with<_Iter1, _Iter2, strong_ordering>) { - return __x.base() <=> __y.base(); - } else { - if (__x.base() < __y.base()) - return strong_ordering::less; - - if (__x.base() == __y.base()) - return strong_ordering::equal; - - return strong_ordering::greater; - } -} -#endif // _LIBCPP_STD_VER >= 20 - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 -#ifndef _LIBCPP_CXX03_LANG - auto - operator-(const __wrap_iter<_Iter1>& __x, - const __wrap_iter<_Iter2>& __y) _NOEXCEPT->decltype(__x.base() - __y.base()) -#else -typename __wrap_iter<_Iter1>::difference_type -operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT -#endif // C++03 -{ +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __wrap_iter<_Iter1>::difference_type +operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT { return __x.base() - __y.base(); } @@ -221,10 +190,8 @@ operator+(typename __wrap_iter<_Iter1>::difference_type __n, __wrap_iter<_Iter1> return __x; } -#if _LIBCPP_STD_VER <= 17 template struct __libcpp_is_contiguous_iterator<__wrap_iter<_It> > : true_type {}; -#endif template struct _LIBCPP_TEMPLATE_VIS pointer_traits<__wrap_iter<_It> > { diff --git a/libcxx/include/__cxx03/__locale b/libcxx/include/__cxx03/__locale index 383b56a1942e8..1deda8d1149e7 100644 --- a/libcxx/include/__cxx03/__locale +++ b/libcxx/include/__cxx03/__locale @@ -84,9 +84,7 @@ public: // locale operations: string name() const; bool operator==(const locale&) const; -#if _LIBCPP_STD_VER <= 17 _LIBCPP_HIDE_FROM_ABI bool operator!=(const locale& __y) const { return !(*this == __y); } -#endif template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool operator()(const basic_string<_CharT, _Traits, _Allocator>&, const basic_string<_CharT, _Traits, _Allocator>&) const; diff --git a/libcxx/include/__cxx03/__locale_dir/locale_base_api/ibm.h b/libcxx/include/__cxx03/__locale_dir/locale_base_api/ibm.h index 0fab9d24d84b6..a24d994e8ea21 100644 --- a/libcxx/include/__cxx03/__locale_dir/locale_base_api/ibm.h +++ b/libcxx/include/__cxx03/__locale_dir/locale_base_api/ibm.h @@ -88,7 +88,7 @@ _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 2, 0) int vasprintf(char** strp, const char va_list ap_copy; // va_copy may not be provided by the C library in C++03 mode. -#if defined(_LIBCPP_CXX03_LANG) && __has_builtin(__builtin_va_copy) +#if __has_builtin(__builtin_va_copy) __builtin_va_copy(ap_copy, ap); #else va_copy(ap_copy, ap); diff --git a/libcxx/include/__cxx03/__math/hypot.h b/libcxx/include/__cxx03/__math/hypot.h index bd87fef5f5ed5..20b00f38d1e64 100644 --- a/libcxx/include/__cxx03/__math/hypot.h +++ b/libcxx/include/__cxx03/__math/hypot.h @@ -50,57 +50,6 @@ inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type hypot(_A1 __x, _ return __math::hypot((__result_type)__x, (__result_type)__y); } -#if _LIBCPP_STD_VER >= 17 -// Computes the three-dimensional hypotenuse: `std::hypot(x,y,z)`. -// The naive implementation might over-/underflow which is why this implementation is more involved: -// If the square of an argument might run into issues, we scale the arguments appropriately. -// See https://github.com/llvm/llvm-project/issues/92782 for a detailed discussion and summary. -template -_LIBCPP_HIDE_FROM_ABI _Real __hypot(_Real __x, _Real __y, _Real __z) { - // Factors needed to determine if over-/underflow might happen - constexpr int __exp = std::numeric_limits<_Real>::max_exponent / 2; - const _Real __overflow_threshold = __math::ldexp(_Real(1), __exp); - const _Real __overflow_scale = __math::ldexp(_Real(1), -(__exp + 20)); - - // Scale arguments depending on their size - const _Real __max_abs = std::max(__math::fabs(__x), std::max(__math::fabs(__y), __math::fabs(__z))); - _Real __scale; - if (__max_abs > __overflow_threshold) { // x*x + y*y + z*z might overflow - __scale = __overflow_scale; - } else if (__max_abs < 1 / __overflow_threshold) { // x*x + y*y + z*z might underflow - __scale = 1 / __overflow_scale; - } else { - __scale = 1; - } - __x *= __scale; - __y *= __scale; - __z *= __scale; - - // Compute hypot of scaled arguments and undo scaling - return __math::sqrt(__x * __x + __y * __y + __z * __z) / __scale; -} - -inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y, float __z) { return __math::__hypot(__x, __y, __z); } - -inline _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y, double __z) { return __math::__hypot(__x, __y, __z); } - -inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y, long double __z) { - return __math::__hypot(__x, __y, __z); -} - -template && is_arithmetic_v<_A2> && is_arithmetic_v<_A3>, int> = 0 > -_LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2, _A3>::type hypot(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT { - using __result_type = typename __promote<_A1, _A2, _A3>::type; - static_assert(!( - std::is_same_v<_A1, __result_type> && std::is_same_v<_A2, __result_type> && std::is_same_v<_A3, __result_type>)); - return __math::__hypot( - static_cast<__result_type>(__x), static_cast<__result_type>(__y), static_cast<__result_type>(__z)); -} -#endif - } // namespace __math _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__cxx03/__memory/addressof.h b/libcxx/include/__cxx03/__memory/addressof.h index 6c88ec87be1ac..81c6a696f0631 100644 --- a/libcxx/include/__cxx03/__memory/addressof.h +++ b/libcxx/include/__cxx03/__memory/addressof.h @@ -51,11 +51,6 @@ inline _LIBCPP_HIDE_FROM_ABI __unsafe_unretained _Tp* addressof(__unsafe_unretai } #endif -#if !defined(_LIBCPP_CXX03_LANG) -template -_Tp* addressof(const _Tp&&) noexcept = delete; -#endif - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___MEMORY_ADDRESSOF_H diff --git a/libcxx/include/__cxx03/__memory/aligned_alloc.h b/libcxx/include/__cxx03/__memory/aligned_alloc.h index af90baeabc140..1efffccffb084 100644 --- a/libcxx/include/__cxx03/__memory/aligned_alloc.h +++ b/libcxx/include/__cxx03/__memory/aligned_alloc.h @@ -30,17 +30,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) { # if defined(_LIBCPP_MSVCRT_LIKE) return ::_aligned_malloc(__size, __alignment); -# elif _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC) - // aligned_alloc() requires that __size is a multiple of __alignment, - // but for C++ [new.delete.general], only states "if the value of an - // alignment argument passed to any of these functions is not a valid - // alignment value, the behavior is undefined". - // To handle calls such as ::operator new(1, std::align_val_t(128)), we - // round __size up to the next multiple of __alignment. - size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1); - // Rounding up could have wrapped around to zero, so we have to add another - // max() ternary to the actual call site to avoid succeeded in that case. - return ::aligned_alloc(__alignment, __size > __rounded_size ? __size : __rounded_size); # else void* __result = nullptr; (void)::posix_memalign(&__result, __alignment, __size); diff --git a/libcxx/include/__cxx03/__memory/allocate_at_least.h b/libcxx/include/__cxx03/__memory/allocate_at_least.h index cb1810855a01d..3906d88599c74 100644 --- a/libcxx/include/__cxx03/__memory/allocate_at_least.h +++ b/libcxx/include/__cxx03/__memory/allocate_at_least.h @@ -19,15 +19,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 23 - -template -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __allocate_at_least(_Alloc& __alloc, size_t __n) { - return std::allocator_traits<_Alloc>::allocate_at_least(__alloc, __n); -} - -#else - template struct __allocation_result { _Pointer ptr; @@ -41,8 +32,6 @@ __allocate_at_least(_Alloc& __alloc, size_t __n) { return {__alloc.allocate(__n), __n}; } -#endif // _LIBCPP_STD_VER >= 23 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___MEMORY_ALLOCATE_AT_LEAST_H diff --git a/libcxx/include/__cxx03/__memory/allocator.h b/libcxx/include/__cxx03/__memory/allocator.h index 06f270a0c008c..a20d2354d41a5 100644 --- a/libcxx/include/__cxx03/__memory/allocator.h +++ b/libcxx/include/__cxx03/__memory/allocator.h @@ -32,7 +32,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD template class allocator; -#if _LIBCPP_STD_VER <= 17 // These specializations shouldn't be marked _LIBCPP_DEPRECATED_IN_CXX17. // Specializing allocator is deprecated, but not using it. template <> @@ -62,8 +61,7 @@ class _LIBCPP_TEMPLATE_VIS allocator { typedef allocator<_Up> other; }; }; -# endif // _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST -#endif // _LIBCPP_STD_VER <= 17 +#endif // _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST // This class provides a non-trivial default constructor to the class that derives from it // if the condition is satisfied. @@ -100,9 +98,7 @@ class _LIBCPP_TEMPLATE_VIS allocator : private __non_trivial_if::v typedef ptrdiff_t difference_type; typedef _Tp value_type; typedef true_type propagate_on_container_move_assignment; -#if _LIBCPP_STD_VER <= 23 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_ALLOCATOR_MEMBERS) _LIBCPP_DEPRECATED_IN_CXX23 typedef true_type is_always_equal; -#endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default; @@ -119,12 +115,6 @@ class _LIBCPP_TEMPLATE_VIS allocator : private __non_trivial_if::v } } -#if _LIBCPP_STD_VER >= 23 - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<_Tp*> allocate_at_least(size_t __n) { - return {allocate(__n), __n}; - } -#endif - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void deallocate(_Tp* __p, size_t __n) _NOEXCEPT { if (__libcpp_is_constant_evaluated()) { ::operator delete(__p); @@ -134,7 +124,6 @@ class _LIBCPP_TEMPLATE_VIS allocator : private __non_trivial_if::v } // C++20 Removed members -#if _LIBCPP_STD_VER <= 17 _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp* pointer; _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer; _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp& reference; @@ -166,103 +155,19 @@ class _LIBCPP_TEMPLATE_VIS allocator : private __non_trivial_if::v } _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); } -#endif }; -// TODO(LLVM 20): Remove the escape hatch -#ifdef _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST -template -class _LIBCPP_TEMPLATE_VIS allocator - : private __non_trivial_if::value, allocator > { - static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types"); - -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef const _Tp value_type; - typedef true_type propagate_on_container_move_assignment; -# if _LIBCPP_STD_VER <= 23 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_ALLOCATOR_MEMBERS) - _LIBCPP_DEPRECATED_IN_CXX23 typedef true_type is_always_equal; -# endif - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default; - - template - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator(const allocator<_Up>&) _NOEXCEPT {} - - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const _Tp* allocate(size_t __n) { - if (__n > allocator_traits::max_size(*this)) - __throw_bad_array_new_length(); - if (__libcpp_is_constant_evaluated()) { - return static_cast(::operator new(__n * sizeof(_Tp))); - } else { - return static_cast(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); - } - } - -# if _LIBCPP_STD_VER >= 23 - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result allocate_at_least(size_t __n) { - return {allocate(__n), __n}; - } -# endif - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void deallocate(const _Tp* __p, size_t __n) { - if (__libcpp_is_constant_evaluated()) { - ::operator delete(const_cast<_Tp*>(__p)); - } else { - std::__libcpp_deallocate((void*)const_cast<_Tp*>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); - } - } - - // C++20 Removed members -# if _LIBCPP_STD_VER <= 17 - _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer; - _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer; - _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference; - _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference; - - template - struct _LIBCPP_DEPRECATED_IN_CXX17 rebind { - typedef allocator<_Up> other; - }; - - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI const_pointer address(const_reference __x) const _NOEXCEPT { - return std::addressof(__x); - } - - _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 const _Tp* allocate(size_t __n, const void*) { - return allocate(__n); - } - - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { - return size_type(~0) / sizeof(_Tp); - } - - template - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args) { - ::new ((void*)__p) _Up(std::forward<_Args>(__args)...); - } - - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); } -# endif -}; -#endif // _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST - template inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT { return true; } -#if _LIBCPP_STD_VER <= 17 - template inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT { return false; } -#endif - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___MEMORY_ALLOCATOR_H diff --git a/libcxx/include/__cxx03/__memory/allocator_arg_t.h b/libcxx/include/__cxx03/__memory/allocator_arg_t.h index 3646b71e42655..1dbea06785b6b 100644 --- a/libcxx/include/__cxx03/__memory/allocator_arg_t.h +++ b/libcxx/include/__cxx03/__memory/allocator_arg_t.h @@ -27,49 +27,6 @@ struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; }; -#if _LIBCPP_STD_VER >= 17 -inline constexpr allocator_arg_t allocator_arg = allocator_arg_t(); -#elif !defined(_LIBCPP_CXX03_LANG) -constexpr allocator_arg_t allocator_arg = allocator_arg_t(); -#endif - -#ifndef _LIBCPP_CXX03_LANG - -// allocator construction - -template -struct __uses_alloc_ctor_imp { - typedef _LIBCPP_NODEBUG __remove_cvref_t<_Alloc> _RawAlloc; - static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value; - static const bool __ic = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; - static const int value = __ua ? 2 - __ic : 0; -}; - -template -struct __uses_alloc_ctor : integral_constant::value> {}; - -template -inline _LIBCPP_HIDE_FROM_ABI void -__user_alloc_construct_impl(integral_constant, _Tp* __storage, const _Allocator&, _Args&&... __args) { - new (__storage) _Tp(std::forward<_Args>(__args)...); -} - -// FIXME: This should have a version which takes a non-const alloc. -template -inline _LIBCPP_HIDE_FROM_ABI void -__user_alloc_construct_impl(integral_constant, _Tp* __storage, const _Allocator& __a, _Args&&... __args) { - new (__storage) _Tp(allocator_arg, __a, std::forward<_Args>(__args)...); -} - -// FIXME: This should have a version which takes a non-const alloc. -template -inline _LIBCPP_HIDE_FROM_ABI void -__user_alloc_construct_impl(integral_constant, _Tp* __storage, const _Allocator& __a, _Args&&... __args) { - new (__storage) _Tp(std::forward<_Args>(__args)..., __a); -} - -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___FUNCTIONAL_ALLOCATOR_ARG_T_H diff --git a/libcxx/include/__cxx03/__memory/allocator_traits.h b/libcxx/include/__cxx03/__memory/allocator_traits.h index e70716c070158..8708ed2ccea4c 100644 --- a/libcxx/include/__cxx03/__memory/allocator_traits.h +++ b/libcxx/include/__cxx03/__memory/allocator_traits.h @@ -61,11 +61,7 @@ struct __const_pointer { }; template struct __const_pointer<_Tp, _Ptr, _Alloc, false> { -#ifdef _LIBCPP_CXX03_LANG using type = typename pointer_traits<_Ptr>::template rebind::other; -#else - using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind; -#endif }; // __void_pointer @@ -76,11 +72,7 @@ struct __void_pointer { }; template struct __void_pointer<_Ptr, _Alloc, false> { -#ifdef _LIBCPP_CXX03_LANG using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind::other; -#else - using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind; -#endif }; // __const_void_pointer @@ -91,11 +83,7 @@ struct __const_void_pointer { }; template struct __const_void_pointer<_Ptr, _Alloc, false> { -#ifdef _LIBCPP_CXX03_LANG using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind::other; -#else - using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind; -#endif }; // __size_type @@ -231,17 +219,6 @@ struct __has_select_on_container_copy_construction< _LIBCPP_SUPPRESS_DEPRECATED_POP -#if _LIBCPP_STD_VER >= 23 - -template -struct allocation_result { - _Pointer ptr; - _SizeType count; -}; -_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(allocation_result); - -#endif // _LIBCPP_STD_VER - template struct _LIBCPP_TEMPLATE_VIS allocator_traits { using allocator_type = _Alloc; @@ -259,12 +236,6 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits { using propagate_on_container_swap = typename __propagate_on_container_swap::type; using is_always_equal = typename __is_always_equal::type; -#ifndef _LIBCPP_CXX03_LANG - template - using rebind_alloc = __allocator_traits_rebind_t; - template - using rebind_traits = allocator_traits >; -#else // _LIBCPP_CXX03_LANG template struct rebind_alloc { using other = __allocator_traits_rebind_t; @@ -273,7 +244,6 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits { struct rebind_traits { using other = allocator_traits::other>; }; -#endif // _LIBCPP_CXX03_LANG _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer allocate(allocator_type& __a, size_type __n) { @@ -295,18 +265,6 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits { return __a.allocate(__n); } -#if _LIBCPP_STD_VER >= 23 - template - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr allocation_result - allocate_at_least(_Ap& __alloc, size_type __n) { - if constexpr (requires { __alloc.allocate_at_least(__n); }) { - return __alloc.allocate_at_least(__n); - } else { - return {__alloc.allocate(__n), __n}; - } - } -#endif - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT { __a.deallocate(__p, __n); @@ -364,13 +322,8 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits { } }; -#ifndef _LIBCPP_CXX03_LANG -template -using __rebind_alloc _LIBCPP_NODEBUG = typename _Traits::template rebind_alloc<_Tp>; -#else template using __rebind_alloc = typename _Traits::template rebind_alloc<_Tp>::other; -#endif template struct __check_valid_allocator : true_type { diff --git a/libcxx/include/__cxx03/__memory/assume_aligned.h b/libcxx/include/__cxx03/__memory/assume_aligned.h index 03a495aac580c..f504e95431cd6 100644 --- a/libcxx/include/__cxx03/__memory/assume_aligned.h +++ b/libcxx/include/__cxx03/__memory/assume_aligned.h @@ -36,15 +36,6 @@ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __ass } } -#if _LIBCPP_STD_VER >= 20 - -template -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* assume_aligned(_Tp* __ptr) { - return std::__assume_aligned<_Np>(__ptr); -} - -#endif // _LIBCPP_STD_VER >= 20 - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___CXX03___MEMORY_ASSUME_ALIGNED_H diff --git a/libcxx/include/__cxx03/__memory/auto_ptr.h b/libcxx/include/__cxx03/__memory/auto_ptr.h index d5d541e1547a5..b27f5cf49cd1e 100644 --- a/libcxx/include/__cxx03/__memory/auto_ptr.h +++ b/libcxx/include/__cxx03/__memory/auto_ptr.h @@ -16,8 +16,6 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) - _LIBCPP_BEGIN_NAMESPACE_STD template @@ -87,6 +85,4 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr { _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) - #endif // _LIBCPP___CXX03___MEMORY_AUTO_PTR_H diff --git a/libcxx/include/__cxx03/__memory/compressed_pair.h b/libcxx/include/__cxx03/__memory/compressed_pair.h index 086621d355d6d..550aa7e62204d 100644 --- a/libcxx/include/__cxx03/__memory/compressed_pair.h +++ b/libcxx/include/__cxx03/__memory/compressed_pair.h @@ -52,13 +52,6 @@ struct __compressed_pair_elem { _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u) : __value_(std::forward<_Up>(__u)) {} -#ifndef _LIBCPP_CXX03_LANG - template - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit __compressed_pair_elem( - piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indices...>) - : __value_(std::forward<_Args>(std::get<_Indices>(__args))...) {} -#endif - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference __get() _NOEXCEPT { return __value_; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __get() const _NOEXCEPT { return __value_; } @@ -81,13 +74,6 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u) : __value_type(std::forward<_Up>(__u)) {} -#ifndef _LIBCPP_CXX03_LANG - template - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 - __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indices...>) - : __value_type(std::forward<_Args>(std::get<_Indices>(__args))...) {} -#endif - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference __get() _NOEXCEPT { return *this; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const_reference __get() const _NOEXCEPT { return *this; } }; @@ -118,14 +104,6 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>, private __comp _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair(_U1&& __t1, _U2&& __t2) : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {} -#ifndef _LIBCPP_CXX03_LANG - template - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit __compressed_pair( - piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) - : _Base1(__pc, std::move(__first_args), typename __make_tuple_indices::type()), - _Base2(__pc, std::move(__second_args), typename __make_tuple_indices::type()) {} -#endif - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename _Base1::reference first() _NOEXCEPT { return static_cast<_Base1&>(*this).__get(); } diff --git a/libcxx/include/__cxx03/__memory/construct_at.h b/libcxx/include/__cxx03/__memory/construct_at.h index 755cdbf9743d1..b2f1a073fdc43 100644 --- a/libcxx/include/__cxx03/__memory/construct_at.h +++ b/libcxx/include/__cxx03/__memory/construct_at.h @@ -33,24 +33,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD // construct_at -#if _LIBCPP_STD_VER >= 20 - -template ()) _Tp(std::declval<_Args>()...))> -_LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&&... __args) { - _LIBCPP_ASSERT_NON_NULL(__location != nullptr, "null pointer given to construct_at"); - return ::new (std::__voidify(*__location)) _Tp(std::forward<_Args>(__args)...); -} - -#endif - template ()) _Tp(std::declval<_Args>()...))> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* __construct_at(_Tp* __location, _Args&&... __args) { -#if _LIBCPP_STD_VER >= 20 - return std::construct_at(__location, std::forward<_Args>(__args)...); -#else return _LIBCPP_ASSERT_NON_NULL(__location != nullptr, "null pointer given to construct_at"), ::new (std::__voidify(*__location)) _Tp(std::forward<_Args>(__args)...); -#endif } // destroy_at @@ -67,14 +53,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc __loc->~_Tp(); } -#if _LIBCPP_STD_VER >= 20 -template ::value, int> = 0> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) { - _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at"); - std::__destroy(std::begin(*__loc), std::end(*__loc)); -} -#endif - template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator __destroy(_ForwardIterator __first, _ForwardIterator __last) { @@ -93,34 +71,6 @@ __reverse_destroy(_BidirectionalIterator __first, _BidirectionalIterator __last) return __last; } -#if _LIBCPP_STD_VER >= 17 - -template , int> = 0> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy_at(_Tp* __loc) { - std::__destroy_at(__loc); -} - -# if _LIBCPP_STD_VER >= 20 -template , int> = 0> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy_at(_Tp* __loc) { - std::__destroy_at(__loc); -} -# endif - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy(_ForwardIterator __first, _ForwardIterator __last) { - (void)std::__destroy(std::move(__first), std::move(__last)); -} - -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator destroy_n(_ForwardIterator __first, _Size __n) { - for (; __n > 0; (void)++__first, --__n) - std::__destroy_at(std::addressof(*__first)); - return __first; -} - -#endif // _LIBCPP_STD_VER >= 17 - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__cxx03/__memory/pointer_traits.h b/libcxx/include/__cxx03/__memory/pointer_traits.h index f1206836676d4..b159515f9722a 100644 --- a/libcxx/include/__cxx03/__memory/pointer_traits.h +++ b/libcxx/include/__cxx03/__memory/pointer_traits.h @@ -93,20 +93,12 @@ struct __has_rebind { template ::value> struct __pointer_traits_rebind { -#ifndef _LIBCPP_CXX03_LANG - typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up> type; -#else typedef _LIBCPP_NODEBUG typename _Tp::template rebind<_Up>::other type; -#endif }; template