aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/CMakeLists.txt2
-rw-r--r--libcxx/include/__functional/bind.h21
-rw-r--r--libcxx/include/__memory_resource/polymorphic_allocator.h10
-rw-r--r--libcxx/include/__mutex/once_flag.h11
-rw-r--r--libcxx/include/__ranges/zip_transform_view.h357
-rw-r--r--libcxx/include/__ranges/zip_view.h8
-rw-r--r--libcxx/include/__thread/thread.h7
-rw-r--r--libcxx/include/__tuple/make_tuple_types.h25
-rw-r--r--libcxx/include/__tuple/tuple_element.h1
-rw-r--r--libcxx/include/__tuple/tuple_indices.h37
-rw-r--r--libcxx/include/__utility/integer_sequence.h68
-rw-r--r--libcxx/include/__utility/pair.h10
-rw-r--r--libcxx/include/bitset10
-rw-r--r--libcxx/include/future9
-rw-r--r--libcxx/include/module.modulemap.in4
-rw-r--r--libcxx/include/mutex7
-rw-r--r--libcxx/include/ranges11
-rw-r--r--libcxx/include/regex2
-rw-r--r--libcxx/include/scoped_allocator10
-rw-r--r--libcxx/include/tuple113
-rw-r--r--libcxx/include/variant4
21 files changed, 519 insertions, 208 deletions
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 25b567df..cd6583c 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -737,6 +737,7 @@ set(files
__ranges/transform_view.h
__ranges/view_interface.h
__ranges/views.h
+ __ranges/zip_transform_view.h
__ranges/zip_view.h
__split_buffer
__std_mbstate_t.h
@@ -780,7 +781,6 @@ set(files
__tuple/make_tuple_types.h
__tuple/sfinae_helpers.h
__tuple/tuple_element.h
- __tuple/tuple_indices.h
__tuple/tuple_like.h
__tuple/tuple_like_ext.h
__tuple/tuple_like_no_subrange.h
diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h
index 596cce0..def9e4c 100644
--- a/libcxx/include/__functional/bind.h
+++ b/libcxx/include/__functional/bind.h
@@ -83,15 +83,14 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& __mu(reference_w
template <class _Ti, class... _Uj, size_t... _Indx>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __invoke_result_t<_Ti&, _Uj...>
-__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>) {
+__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __index_sequence<_Indx...>) {
return __ti(std::forward<_Uj>(std::get<_Indx>(__uj))...);
}
template <class _Ti, class... _Uj, __enable_if_t<is_bind_expression<_Ti>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __invoke_result_t<_Ti&, _Uj...>
__mu(_Ti& __ti, tuple<_Uj...>& __uj) {
- typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
- return std::__mu_expand(__ti, __uj, __indices());
+ return std::__mu_expand(__ti, __uj, __make_index_sequence<sizeof...(_Uj)>());
}
template <bool _IsPh, class _Ti, class _Uj>
@@ -191,7 +190,7 @@ struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true> {
template <class _Fp, class _BoundArgs, size_t... _Indx, class _Args>
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) {
+__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __index_sequence<_Indx...>, _Args&& __args) {
return std::__invoke(__f, std::__mu(std::get<_Indx>(__bound_args), __args)...);
}
@@ -205,8 +204,6 @@ private:
_Fd __f_;
_Td __bound_args_;
- typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
-
public:
template <
class _Gp,
@@ -219,14 +216,22 @@ public:
template <class... _Args>
_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)...));
+ return std::__apply_functor(
+ __f_,
+ __bound_args_,
+ __make_index_sequence<sizeof...(_BoundArgs)>(),
+ tuple<_Args&&...>(std::forward<_Args>(__args)...));
}
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
operator()(_Args&&... __args) const {
- return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
+ return std::__apply_functor(
+ __f_,
+ __bound_args_,
+ __make_index_sequence<sizeof...(_BoundArgs)>(),
+ tuple<_Args&&...>(std::forward<_Args>(__args)...));
}
};
diff --git a/libcxx/include/__memory_resource/polymorphic_allocator.h b/libcxx/include/__memory_resource/polymorphic_allocator.h
index 1b8711f..6e7a9af 100644
--- a/libcxx/include/__memory_resource/polymorphic_allocator.h
+++ b/libcxx/include/__memory_resource/polymorphic_allocator.h
@@ -135,10 +135,10 @@ public:
piecewise_construct,
__transform_tuple(typename __uses_alloc_ctor< _T1, polymorphic_allocator&, _Args1... >::type(),
std::move(__x),
- typename __make_tuple_indices<sizeof...(_Args1)>::type{}),
+ make_index_sequence<sizeof...(_Args1)>()),
__transform_tuple(typename __uses_alloc_ctor< _T2, polymorphic_allocator&, _Args2... >::type(),
std::move(__y),
- typename __make_tuple_indices<sizeof...(_Args2)>::type{}));
+ make_index_sequence<sizeof...(_Args2)>()));
}
template <class _T1, class _T2>
@@ -194,20 +194,20 @@ public:
private:
template <class... _Args, size_t... _Is>
_LIBCPP_HIDE_FROM_ABI tuple<_Args&&...>
- __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) {
+ __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, index_sequence<_Is...>) {
return std::forward_as_tuple(std::get<_Is>(std::move(__t))...);
}
template <class... _Args, size_t... _Is>
_LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>
- __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) {
+ __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, index_sequence<_Is...>) {
using _Tup = tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>;
return _Tup(allocator_arg, *this, std::get<_Is>(std::move(__t))...);
}
template <class... _Args, size_t... _Is>
_LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., polymorphic_allocator&>
- __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __tuple_indices<_Is...>) {
+ __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, index_sequence<_Is...>) {
using _Tup = tuple<_Args&&..., polymorphic_allocator&>;
return _Tup(std::get<_Is>(std::move(__t))..., *this);
}
diff --git a/libcxx/include/__mutex/once_flag.h b/libcxx/include/__mutex/once_flag.h
index 3306449..e384c15 100644
--- a/libcxx/include/__mutex/once_flag.h
+++ b/libcxx/include/__mutex/once_flag.h
@@ -13,9 +13,9 @@
#include <__functional/invoke.h>
#include <__memory/addressof.h>
#include <__memory/shared_count.h> // __libcpp_acquire_load
-#include <__tuple/tuple_indices.h>
#include <__tuple/tuple_size.h>
#include <__utility/forward.h>
+#include <__utility/integer_sequence.h>
#include <__utility/move.h>
#include <cstdint>
#ifndef _LIBCPP_CXX03_LANG
@@ -87,15 +87,12 @@ class __call_once_param {
public:
_LIBCPP_HIDE_FROM_ABI explicit __call_once_param(_Fp& __f) : __f_(__f) {}
- _LIBCPP_HIDE_FROM_ABI void operator()() {
- typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
- __execute(_Index());
- }
+ _LIBCPP_HIDE_FROM_ABI void operator()() { __execute(__make_index_sequence<tuple_size<_Fp>::value>()); }
private:
template <size_t... _Indices>
- _LIBCPP_HIDE_FROM_ABI void __execute(__tuple_indices<_Indices...>) {
- std::__invoke(std::get<0>(std::move(__f_)), std::get<_Indices>(std::move(__f_))...);
+ _LIBCPP_HIDE_FROM_ABI void __execute(__index_sequence<_Indices...>) {
+ std::__invoke(std::get<_Indices>(std::move(__f_))...);
}
};
diff --git a/libcxx/include/__ranges/zip_transform_view.h b/libcxx/include/__ranges/zip_transform_view.h
new file mode 100644
index 0000000..07aa182f
--- /dev/null
+++ b/libcxx/include/__ranges/zip_transform_view.h
@@ -0,0 +1,357 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___RANGES_ZIP_TRANSFORM_VIEW_H
+#define _LIBCPP___RANGES_ZIP_TRANSFORM_VIEW_H
+
+#include <__config>
+
+#include <__concepts/constructible.h>
+#include <__concepts/convertible_to.h>
+#include <__concepts/derived_from.h>
+#include <__concepts/equality_comparable.h>
+#include <__concepts/invocable.h>
+#include <__functional/invoke.h>
+#include <__iterator/concepts.h>
+#include <__iterator/incrementable_traits.h>
+#include <__iterator/iterator_traits.h>
+#include <__memory/addressof.h>
+#include <__ranges/access.h>
+#include <__ranges/all.h>
+#include <__ranges/concepts.h>
+#include <__ranges/empty_view.h>
+#include <__ranges/movable_box.h>
+#include <__ranges/view_interface.h>
+#include <__ranges/zip_view.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/invoke.h>
+#include <__type_traits/is_object.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/is_referenceable.h>
+#include <__type_traits/maybe_const.h>
+#include <__type_traits/remove_cvref.h>
+#include <__utility/forward.h>
+#include <__utility/in_place.h>
+#include <__utility/move.h>
+#include <tuple> // for std::apply
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+namespace ranges {
+
+template <move_constructible _Fn, input_range... _Views>
+ requires(view<_Views> && ...) &&
+ (sizeof...(_Views) > 0) && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_Views>...> &&
+ __referenceable<invoke_result_t<_Fn&, range_reference_t<_Views>...>>
+class zip_transform_view : public view_interface<zip_transform_view<_Fn, _Views...>> {
+ _LIBCPP_NO_UNIQUE_ADDRESS zip_view<_Views...> __zip_;
+ _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Fn> __fun_;
+
+ using _InnerView _LIBCPP_NODEBUG = zip_view<_Views...>;
+ template <bool _Const>
+ using __ziperator _LIBCPP_NODEBUG = iterator_t<__maybe_const<_Const, _InnerView>>;
+ template <bool _Const>
+ using __zentinel _LIBCPP_NODEBUG = sentinel_t<__maybe_const<_Const, _InnerView>>;
+
+ template <bool>
+ class __iterator;
+
+ template <bool>
+ class __sentinel;
+
+public:
+ _LIBCPP_HIDE_FROM_ABI zip_transform_view() = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit zip_transform_view(_Fn __fun, _Views... __views)
+ : __zip_(std::move(__views)...), __fun_(in_place, std::move(__fun)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { return __iterator<false>(*this, __zip_.begin()); }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const
+ requires range<const _InnerView> && regular_invocable<const _Fn&, range_reference_t<const _Views>...>
+ {
+ return __iterator<true>(*this, __zip_.begin());
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
+ if constexpr (common_range<_InnerView>) {
+ return __iterator<false>(*this, __zip_.end());
+ } else {
+ return __sentinel<false>(__zip_.end());
+ }
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto end() const
+ requires range<const _InnerView> && regular_invocable<const _Fn&, range_reference_t<const _Views>...>
+ {
+ if constexpr (common_range<const _InnerView>) {
+ return __iterator<true>(*this, __zip_.end());
+ } else {
+ return __sentinel<true>(__zip_.end());
+ }
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size()
+ requires sized_range<_InnerView>
+ {
+ return __zip_.size();
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto size() const
+ requires sized_range<const _InnerView>
+ {
+ return __zip_.size();
+ }
+};
+
+template <class _Fn, class... _Ranges>
+zip_transform_view(_Fn, _Ranges&&...) -> zip_transform_view<_Fn, views::all_t<_Ranges>...>;
+
+template <bool _Const, class _Fn, class... _Views>
+struct __zip_transform_iterator_category_base {};
+
+template <bool _Const, class _Fn, class... _Views>
+ requires forward_range<__maybe_const<_Const, zip_view<_Views...>>>
+struct __zip_transform_iterator_category_base<_Const, _Fn, _Views...> {
+private:
+ template <class _View>
+ using __tag _LIBCPP_NODEBUG = typename iterator_traits<iterator_t<__maybe_const<_Const, _View>>>::iterator_category;
+
+ static consteval auto __get_iterator_category() {
+ if constexpr (!is_reference_v<invoke_result_t<__maybe_const<_Const, _Fn>&,
+ range_reference_t<__maybe_const<_Const, _Views>>...>>) {
+ return input_iterator_tag();
+ } else if constexpr ((derived_from<__tag<_Views>, random_access_iterator_tag> && ...)) {
+ return random_access_iterator_tag();
+ } else if constexpr ((derived_from<__tag<_Views>, bidirectional_iterator_tag> && ...)) {
+ return bidirectional_iterator_tag();
+ } else if constexpr ((derived_from<__tag<_Views>, forward_iterator_tag> && ...)) {
+ return forward_iterator_tag();
+ } else {
+ return input_iterator_tag();
+ }
+ }
+
+public:
+ using iterator_category = decltype(__get_iterator_category());
+};
+
+template <move_constructible _Fn, input_range... _Views>
+ requires(view<_Views> && ...) &&
+ (sizeof...(_Views) > 0) && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_Views>...> &&
+ __referenceable<invoke_result_t<_Fn&, range_reference_t<_Views>...>>
+template <bool _Const>
+class zip_transform_view<_Fn, _Views...>::__iterator
+ : public __zip_transform_iterator_category_base<_Const, _Fn, _Views...> {
+ using _Parent _LIBCPP_NODEBUG = __maybe_const<_Const, zip_transform_view>;
+ using _Base _LIBCPP_NODEBUG = __maybe_const<_Const, _InnerView>;
+
+ friend zip_transform_view<_Fn, _Views...>;
+
+ _Parent* __parent_ = nullptr;
+ __ziperator<_Const> __inner_;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent& __parent, __ziperator<_Const> __inner)
+ : __parent_(std::addressof(__parent)), __inner_(std::move(__inner)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr auto __get_deref_and_invoke() const noexcept {
+ return [&__fun = *__parent_->__fun_](const auto&... __iters) noexcept(noexcept(std::invoke(
+ *__parent_->__fun_, *__iters...))) -> decltype(auto) { return std::invoke(__fun, *__iters...); };
+ }
+
+public:
+ using iterator_concept = typename __ziperator<_Const>::iterator_concept;
+ using value_type =
+ remove_cvref_t<invoke_result_t<__maybe_const<_Const, _Fn>&, range_reference_t<__maybe_const<_Const, _Views>>...>>;
+ using difference_type = range_difference_t<_Base>;
+
+ _LIBCPP_HIDE_FROM_ABI __iterator() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i)
+ requires _Const && convertible_to<__ziperator<false>, __ziperator<_Const>>
+ : __parent_(__i.__parent_), __inner_(std::move(__i.__inner_)) {}
+
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const
+ noexcept(noexcept(std::apply(__get_deref_and_invoke(), __zip_view_iterator_access::__get_underlying(__inner_)))) {
+ return std::apply(__get_deref_and_invoke(), __zip_view_iterator_access::__get_underlying(__inner_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() {
+ ++__inner_;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int)
+ requires forward_range<_Base>
+ {
+ auto __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--()
+ requires bidirectional_range<_Base>
+ {
+ --__inner_;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int)
+ requires bidirectional_range<_Base>
+ {
+ auto __tmp = *this;
+ --*this;
+ return __tmp;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __x)
+ requires random_access_range<_Base>
+ {
+ __inner_ += __x;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __x)
+ requires random_access_range<_Base>
+ {
+ __inner_ -= __x;
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator[](difference_type __n) const
+ requires random_access_range<_Base>
+ {
+ return std::apply(
+ [&]<class... _Is>(const _Is&... __iters) -> decltype(auto) {
+ return std::invoke(*__parent_->__fun_, __iters[iter_difference_t<_Is>(__n)]...);
+ },
+ __zip_view_iterator_access::__get_underlying(__inner_));
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y)
+ requires equality_comparable<__ziperator<_Const>>
+ {
+ return __x.__inner_ == __y.__inner_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y)
+ requires random_access_range<_Base>
+ {
+ return __x.__inner_ <=> __y.__inner_;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __i, difference_type __n)
+ requires random_access_range<_Base>
+ {
+ return __iterator(*__i.__parent_, __i.__inner_ + __n);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __n, const __iterator& __i)
+ requires random_access_range<_Base>
+ {
+ return __iterator(*__i.__parent_, __i.__inner_ + __n);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __i, difference_type __n)
+ requires random_access_range<_Base>
+ {
+ return __iterator(*__i.__parent_, __i.__inner_ - __n);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y)
+ requires sized_sentinel_for<__ziperator<_Const>, __ziperator<_Const>>
+ {
+ return __x.__inner_ - __y.__inner_;
+ }
+};
+
+template <move_constructible _Fn, input_range... _Views>
+ requires(view<_Views> && ...) &&
+ (sizeof...(_Views) > 0) && is_object_v<_Fn> && regular_invocable<_Fn&, range_reference_t<_Views>...> &&
+ __referenceable<invoke_result_t<_Fn&, range_reference_t<_Views>...>>
+template <bool _Const>
+class zip_transform_view<_Fn, _Views...>::__sentinel {
+ __zentinel<_Const> __inner_;
+
+ friend zip_transform_view<_Fn, _Views...>;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(__zentinel<_Const> __inner) : __inner_(__inner) {}
+
+public:
+ _LIBCPP_HIDE_FROM_ABI __sentinel() = default;
+
+ _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __i)
+ requires _Const && convertible_to<__zentinel<false>, __zentinel<_Const>>
+ : __inner_(__i.__inner_) {}
+
+ template <bool _OtherConst>
+ requires sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
+ return __x.__inner_ == __y.__inner_;
+ }
+
+ template <bool _OtherConst>
+ requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
+ operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) {
+ return __x.__inner_ - __y.__inner_;
+ }
+
+ template <bool _OtherConst>
+ requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>>
+ _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _InnerView>>
+ operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) {
+ return __x.__inner_ - __y.__inner_;
+ }
+};
+
+namespace views {
+namespace __zip_transform {
+
+struct __fn {
+ template <class _Fn>
+ requires(move_constructible<decay_t<_Fn>> && regular_invocable<decay_t<_Fn>&> &&
+ is_object_v<invoke_result_t<decay_t<_Fn>&>>)
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&&) const
+ noexcept(noexcept(auto(views::empty<decay_t<invoke_result_t<decay_t<_Fn>&>>>))) {
+ return views::empty<decay_t<invoke_result_t<decay_t<_Fn>&>>>;
+ }
+
+ template <class _Fn, class... _Ranges>
+ requires(sizeof...(_Ranges) > 0)
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Fn&& __fun, _Ranges&&... __rs) const
+ noexcept(noexcept(zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...)))
+ -> decltype(zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...)) {
+ return zip_transform_view(std::forward<_Fn>(__fun), std::forward<_Ranges>(__rs)...);
+ }
+};
+
+} // namespace __zip_transform
+inline namespace __cpo {
+inline constexpr auto zip_transform = __zip_transform::__fn{};
+} // namespace __cpo
+} // namespace views
+} // namespace ranges
+
+#endif // _LIBCPP_STD_VER >= 23
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___RANGES_ZIP_TRANSFORM_VIEW_H
diff --git a/libcxx/include/__ranges/zip_view.h b/libcxx/include/__ranges/zip_view.h
index e2a194e..ce00c98 100644
--- a/libcxx/include/__ranges/zip_view.h
+++ b/libcxx/include/__ranges/zip_view.h
@@ -235,6 +235,13 @@ struct __zip_view_iterator_category_base<_Const, _Views...> {
using iterator_category = input_iterator_tag;
};
+struct __zip_view_iterator_access {
+ template <class _Iter>
+ _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __get_underlying(_Iter& __iter) noexcept {
+ return (__iter.__current_);
+ }
+};
+
template <input_range... _Views>
requires(view<_Views> && ...) && (sizeof...(_Views) > 0)
template <bool _Const>
@@ -255,6 +262,7 @@ class zip_view<_Views...>::__iterator : public __zip_view_iterator_category_base
static constexpr bool __is_zip_view_iterator = true;
friend struct __product_iterator_traits<__iterator>;
+ friend __zip_view_iterator_access;
public:
using iterator_concept = decltype(ranges::__get_zip_view_iterator_tag<_Const, _Views...>());
diff --git a/libcxx/include/__thread/thread.h b/libcxx/include/__thread/thread.h
index 1b51571..a3b672b 100644
--- a/libcxx/include/__thread/thread.h
+++ b/libcxx/include/__thread/thread.h
@@ -155,8 +155,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) {
# ifndef _LIBCPP_CXX03_LANG
template <class _TSp, class _Fp, class... _Args, size_t... _Indices>
-inline _LIBCPP_HIDE_FROM_ABI void __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>) {
- std::__invoke(std::move(std::get<1>(__t)), std::move(std::get<_Indices>(__t))...);
+inline _LIBCPP_HIDE_FROM_ABI void __thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __index_sequence<_Indices...>) {
+ std::__invoke(std::move(std::get<_Indices + 1>(__t))...);
}
template <class _Fp>
@@ -164,8 +164,7 @@ _LIBCPP_HIDE_FROM_ABI void* __thread_proxy(void* __vp) {
// _Fp = tuple< unique_ptr<__thread_struct>, Functor, Args...>
unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
__thread_local_data().set_pointer(std::get<0>(*__p.get()).release());
- typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 2>::type _Index;
- std::__thread_execute(*__p.get(), _Index());
+ std::__thread_execute(*__p.get(), __make_index_sequence<tuple_size<_Fp>::value - 1>());
return nullptr;
}
diff --git a/libcxx/include/__tuple/make_tuple_types.h b/libcxx/include/__tuple/make_tuple_types.h
index a5c9bcf..3c22ec8 100644
--- a/libcxx/include/__tuple/make_tuple_types.h
+++ b/libcxx/include/__tuple/make_tuple_types.h
@@ -14,12 +14,12 @@
#include <__fwd/array.h>
#include <__fwd/tuple.h>
#include <__tuple/tuple_element.h>
-#include <__tuple/tuple_indices.h>
#include <__tuple/tuple_size.h>
#include <__tuple/tuple_types.h>
#include <__type_traits/copy_cvref.h>
#include <__type_traits/remove_cvref.h>
#include <__type_traits/remove_reference.h>
+#include <__utility/integer_sequence.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -38,38 +38,35 @@ template <class _TupleTypes, class _TupleIndices>
struct __make_tuple_types_flat;
template <template <class...> class _Tuple, class... _Types, size_t... _Idx>
-struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> {
+struct __make_tuple_types_flat<_Tuple<_Types...>, __index_sequence<_Idx...>> {
// Specialization for pair, tuple, and __tuple_types
template <class _Tp>
using __apply_quals _LIBCPP_NODEBUG = __tuple_types<__copy_cvref_t<_Tp, __type_pack_element<_Idx, _Types...>>...>;
};
template <class _Vt, size_t _Np, size_t... _Idx>
-struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> {
+struct __make_tuple_types_flat<array<_Vt, _Np>, __index_sequence<_Idx...>> {
template <size_t>
using __value_type _LIBCPP_NODEBUG = _Vt;
template <class _Tp>
using __apply_quals _LIBCPP_NODEBUG = __tuple_types<__copy_cvref_t<_Tp, __value_type<_Idx>>...>;
};
-template <class _Tp,
- size_t _Ep = tuple_size<__libcpp_remove_reference_t<_Tp> >::value,
- size_t _Sp = 0,
- bool _SameSize = (_Ep == tuple_size<__libcpp_remove_reference_t<_Tp> >::value)>
+template <class _Tp>
struct __make_tuple_types {
- static_assert(_Sp <= _Ep, "__make_tuple_types input error");
using _RawTp _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>;
- using _Maker _LIBCPP_NODEBUG = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>;
- using type _LIBCPP_NODEBUG = typename _Maker::template __apply_quals<_Tp>;
+ using _Maker _LIBCPP_NODEBUG =
+ __make_tuple_types_flat<_RawTp, __make_index_sequence<tuple_size<__libcpp_remove_reference_t<_Tp>>::value>>;
+ using type _LIBCPP_NODEBUG = typename _Maker::template __apply_quals<_Tp>;
};
-template <class... _Types, size_t _Ep>
-struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> {
+template <class... _Types>
+struct __make_tuple_types<tuple<_Types...>> {
using type _LIBCPP_NODEBUG = __tuple_types<_Types...>;
};
-template <class... _Types, size_t _Ep>
-struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> {
+template <class... _Types>
+struct __make_tuple_types<__tuple_types<_Types...>> {
using type _LIBCPP_NODEBUG = __tuple_types<_Types...>;
};
diff --git a/libcxx/include/__tuple/tuple_element.h b/libcxx/include/__tuple/tuple_element.h
index f67c867..607ac3a 100644
--- a/libcxx/include/__tuple/tuple_element.h
+++ b/libcxx/include/__tuple/tuple_element.h
@@ -11,7 +11,6 @@
#include <__config>
#include <__cstddef/size_t.h>
-#include <__tuple/tuple_indices.h>
#include <__tuple/tuple_types.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__tuple/tuple_indices.h b/libcxx/include/__tuple/tuple_indices.h
deleted file mode 100644
index 25dc9ec..0000000
--- a/libcxx/include/__tuple/tuple_indices.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___TUPLE_MAKE_TUPLE_INDICES_H
-#define _LIBCPP___TUPLE_MAKE_TUPLE_INDICES_H
-
-#include <__config>
-#include <__cstddef/size_t.h>
-#include <__utility/integer_sequence.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#ifndef _LIBCPP_CXX03_LANG
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <size_t...>
-struct __tuple_indices {};
-
-template <size_t _Ep, size_t _Sp = 0>
-struct __make_tuple_indices {
- static_assert(_Sp <= _Ep, "__make_tuple_indices input error");
- typedef __make_indices_imp<_Ep, _Sp> type;
-};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_CXX03_LANG
-
-#endif // _LIBCPP___TUPLE_MAKE_TUPLE_INDICES_H
diff --git a/libcxx/include/__utility/integer_sequence.h b/libcxx/include/__utility/integer_sequence.h
index d1c6e53..329826a 100644
--- a/libcxx/include/__utility/integer_sequence.h
+++ b/libcxx/include/__utility/integer_sequence.h
@@ -17,57 +17,41 @@
# pragma GCC system_header
#endif
+#ifndef _LIBCPP_CXX03_LANG
+
_LIBCPP_BEGIN_NAMESPACE_STD
-template <size_t...>
-struct __tuple_indices;
+# if __has_builtin(__make_integer_seq)
+template <template <class _Tp, _Tp...> class _BaseType, class _Tp, _Tp _SequenceSize>
+using __make_integer_sequence_impl _LIBCPP_NODEBUG = __make_integer_seq<_BaseType, _Tp, _SequenceSize>;
+# else
+template <template <class _Tp, _Tp...> class _BaseType, class _Tp, _Tp _SequenceSize>
+using __make_integer_sequence_impl _LIBCPP_NODEBUG = _BaseType<_Tp, __integer_pack(_SequenceSize)...>;
+# endif
-template <class _IdxType, _IdxType... _Values>
+template <class _Tp, _Tp... _Indices>
struct __integer_sequence {
- template <template <class _OIdxType, _OIdxType...> class _ToIndexSeq, class _ToIndexType>
- using __convert _LIBCPP_NODEBUG = _ToIndexSeq<_ToIndexType, _Values...>;
-
- template <size_t _Sp>
- using __to_tuple_indices _LIBCPP_NODEBUG = __tuple_indices<(_Values + _Sp)...>;
+ using value_type = _Tp;
+ static_assert(is_integral<_Tp>::value, "std::integer_sequence can only be instantiated with an integral type");
+ static _LIBCPP_HIDE_FROM_ABI constexpr size_t size() noexcept { return sizeof...(_Indices); }
};
-#if __has_builtin(__make_integer_seq)
-template <size_t _Ep, size_t _Sp>
-using __make_indices_imp _LIBCPP_NODEBUG =
- typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template __to_tuple_indices<_Sp>;
-#elif __has_builtin(__integer_pack)
-template <size_t _Ep, size_t _Sp>
-using __make_indices_imp _LIBCPP_NODEBUG =
- typename __integer_sequence<size_t, __integer_pack(_Ep - _Sp)...>::template __to_tuple_indices<_Sp>;
-#else
-# error "No known way to get an integer pack from the compiler"
-#endif
+template <size_t... _Indices>
+using __index_sequence _LIBCPP_NODEBUG = __integer_sequence<size_t, _Indices...>;
-#if _LIBCPP_STD_VER >= 14
+template <size_t _SequenceSize>
+using __make_index_sequence _LIBCPP_NODEBUG = __make_integer_sequence_impl<__integer_sequence, size_t, _SequenceSize>;
-template <class _Tp, _Tp... _Ip>
-struct integer_sequence {
- typedef _Tp value_type;
- static_assert(is_integral<_Tp>::value, "std::integer_sequence can only be instantiated with an integral type");
- static _LIBCPP_HIDE_FROM_ABI constexpr size_t size() noexcept { return sizeof...(_Ip); }
-};
+# if _LIBCPP_STD_VER >= 14
+
+template <class _Tp, _Tp... _Indices>
+struct integer_sequence : __integer_sequence<_Tp, _Indices...> {};
template <size_t... _Ip>
using index_sequence = integer_sequence<size_t, _Ip...>;
-# if __has_builtin(__make_integer_seq)
-
template <class _Tp, _Tp _Ep>
-using make_integer_sequence _LIBCPP_NODEBUG = __make_integer_seq<integer_sequence, _Tp, _Ep>;
-
-# elif __has_builtin(__integer_pack)
-
-template <class _Tp, _Tp _SequenceSize>
-using make_integer_sequence _LIBCPP_NODEBUG = integer_sequence<_Tp, __integer_pack(_SequenceSize)...>;
-
-# else
-# error "No known way to get an integer pack from the compiler"
-# endif
+using make_integer_sequence _LIBCPP_NODEBUG = __make_integer_sequence_impl<integer_sequence, _Tp, _Ep>;
template <size_t _Np>
using make_index_sequence = make_integer_sequence<size_t, _Np>;
@@ -75,16 +59,18 @@ using make_index_sequence = make_integer_sequence<size_t, _Np>;
template <class... _Tp>
using index_sequence_for = make_index_sequence<sizeof...(_Tp)>;
-# if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
// Executes __func for every element in an index_sequence.
template <size_t... _Index, class _Function>
_LIBCPP_HIDE_FROM_ABI constexpr void __for_each_index_sequence(index_sequence<_Index...>, _Function __func) {
(__func.template operator()<_Index>(), ...);
}
-# endif // _LIBCPP_STD_VER >= 20
+# endif // _LIBCPP_STD_VER >= 20
-#endif // _LIBCPP_STD_VER >= 14
+# endif // _LIBCPP_STD_VER >= 14
_LIBCPP_END_NAMESPACE_STD
+#endif // _LIBCPP_CXX03_LANG
+
#endif // _LIBCPP___UTILITY_INTEGER_SEQUENCE_H
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index dbacbce..33694c52 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -18,7 +18,6 @@
#include <__fwd/array.h>
#include <__fwd/pair.h>
#include <__fwd/tuple.h>
-#include <__tuple/tuple_indices.h>
#include <__tuple/tuple_like_no_subrange.h>
#include <__tuple/tuple_size.h>
#include <__type_traits/common_reference.h>
@@ -40,6 +39,7 @@
#include <__type_traits/unwrap_ref.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
+#include <__utility/integer_sequence.h>
#include <__utility/move.h>
#include <__utility/piecewise_construct.h>
@@ -225,8 +225,8 @@ struct pair
: pair(__pc,
__first_args,
__second_args,
- typename __make_tuple_indices<sizeof...(_Args1)>::type(),
- typename __make_tuple_indices<sizeof...(_Args2) >::type()) {}
+ __make_index_sequence<sizeof...(_Args1)>(),
+ __make_index_sequence<sizeof...(_Args2)>()) {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair&
operator=(__conditional_t<is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value,
@@ -440,8 +440,8 @@ private:
pair(piecewise_construct_t,
tuple<_Args1...>& __first_args,
tuple<_Args2...>& __second_args,
- __tuple_indices<_I1...>,
- __tuple_indices<_I2...>)
+ __index_sequence<_I1...>,
+ __index_sequence<_I2...>)
: first(std::forward<_Args1>(std::get<_I1>(__first_args))...),
second(std::forward<_Args2>(std::get<_I2>(__second_args))...) {}
#endif
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index d109f27..e2b4615 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -147,7 +147,6 @@ template <size_t N> struct hash<std::bitset<N>>;
# include <__functional/hash.h>
# include <__functional/identity.h>
# include <__functional/unary_function.h>
-# include <__tuple/tuple_indices.h>
# include <__type_traits/enable_if.h>
# include <__type_traits/integral_constant.h>
# include <__type_traits/is_char_like_type.h>
@@ -314,7 +313,7 @@ private:
_LIBCPP_HIDE_FROM_ABI void __init(unsigned long long __v, true_type) _NOEXCEPT;
# else
template <size_t... _Indices>
- _LIBCPP_HIDE_FROM_ABI constexpr __bitset(unsigned long long __v, std::__tuple_indices<_Indices...>) _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI constexpr __bitset(unsigned long long __v, __index_sequence<_Indices...>) _NOEXCEPT
: __first_{static_cast<__storage_type>(__v >> (_Indices * __bits_per_word))...} {}
# endif // _LIBCPP_CXX03_LANG
};
@@ -352,10 +351,9 @@ template <size_t _N_words, size_t _Size>
inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
# ifndef _LIBCPP_CXX03_LANG
: __bitset(__v,
- std::__make_indices_imp< (_N_words < (sizeof(unsigned long long) - 1) / sizeof(__storage_type) + 1)
- ? _N_words
- : (sizeof(unsigned long long) - 1) / sizeof(__storage_type) + 1,
- 0>{})
+ __make_index_sequence<(_N_words < (sizeof(unsigned long long) - 1) / sizeof(__storage_type) + 1)
+ ? _N_words
+ : (sizeof(unsigned long long) - 1) / sizeof(__storage_type) + 1>())
# endif
{
# ifdef _LIBCPP_CXX03_LANG
diff --git a/libcxx/include/future b/libcxx/include/future
index abdd82d..3df9dc9 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -1842,15 +1842,12 @@ public:
_LIBCPP_HIDE_FROM_ABI __async_func(__async_func&& __f) : __f_(std::move(__f.__f_)) {}
- _LIBCPP_HIDE_FROM_ABI _Rp operator()() {
- typedef typename __make_tuple_indices<1 + sizeof...(_Args), 1>::type _Index;
- return __execute(_Index());
- }
+ _LIBCPP_HIDE_FROM_ABI _Rp operator()() { return __execute(__make_index_sequence<sizeof...(_Args) + 1>()); }
private:
template <size_t... _Indices>
- _LIBCPP_HIDE_FROM_ABI _Rp __execute(__tuple_indices<_Indices...>) {
- return std::__invoke(std::move(std::get<0>(__f_)), std::move(std::get<_Indices>(__f_))...);
+ _LIBCPP_HIDE_FROM_ABI _Rp __execute(__index_sequence<_Indices...>) {
+ return std::__invoke(std::move(std::get<_Indices>(__f_))...);
}
};
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 78607f2..ac49720 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -1943,6 +1943,9 @@ module std [system] {
header "__ranges/zip_view.h"
export std.utility.pair
}
+ module zip_transform_view {
+ header "__ranges/zip_transform_view.h"
+ }
header "ranges"
export *
@@ -2110,7 +2113,6 @@ module std [system] {
module make_tuple_types { header "__tuple/make_tuple_types.h" }
module sfinae_helpers { header "__tuple/sfinae_helpers.h" }
module tuple_element { header "__tuple/tuple_element.h" }
- module tuple_indices { header "__tuple/tuple_indices.h" }
module tuple_like_ext { header "__tuple/tuple_like_ext.h" }
module tuple_like_no_subrange { header "__tuple/tuple_like_no_subrange.h" }
module tuple_like { header "__tuple/tuple_like.h" }
diff --git a/libcxx/include/mutex b/libcxx/include/mutex
index dc8e711..78d8c8a 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -469,17 +469,14 @@ public:
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI scoped_lock(adopt_lock_t, _MArgs&... __margs) : __t_(__margs...) {}
- _LIBCPP_HIDE_FROM_ABI ~scoped_lock() {
- typedef typename __make_tuple_indices<sizeof...(_MArgs)>::type _Indices;
- __unlock_unpack(_Indices{}, __t_);
- }
+ _LIBCPP_HIDE_FROM_ABI ~scoped_lock() { __unlock_unpack(make_index_sequence<sizeof...(_MArgs)>(), __t_); }
scoped_lock(scoped_lock const&) = delete;
scoped_lock& operator=(scoped_lock const&) = delete;
private:
template <size_t... _Indx>
- _LIBCPP_HIDE_FROM_ABI static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) {
+ _LIBCPP_HIDE_FROM_ABI static void __unlock_unpack(index_sequence<_Indx...>, _MutexTuple& __mt) {
(std::get<_Indx>(__mt).unlock(), ...);
}
diff --git a/libcxx/include/ranges b/libcxx/include/ranges
index 2a6321b..96d7a6b 100644
--- a/libcxx/include/ranges
+++ b/libcxx/include/ranges
@@ -339,6 +339,16 @@ namespace std::ranges {
namespace views { inline constexpr unspecified zip = unspecified; } // C++23
+ // [range.zip.transform], zip transform view
+ template<move_constructible F, input_range... Views>
+ requires (view<Views> && ...) && (sizeof...(Views) > 0) && is_object_v<F> &&
+ regular_invocable<F&, range_reference_t<Views>...> &&
+ can-reference<invoke_result_t<F&, range_reference_t<Views>...>>
+ class zip_transform_view; // C++23
+
+ namespace views { inline constexpr unspecified zip_transform = unspecified; } // C++23
+
+
// [range.as.rvalue]
template <view V>
requires input_range<V>
@@ -439,6 +449,7 @@ namespace std {
# include <__ranges/join_with_view.h>
# include <__ranges/repeat_view.h>
# include <__ranges/to.h>
+# include <__ranges/zip_transform_view.h>
# include <__ranges/zip_view.h>
# endif
diff --git a/libcxx/include/regex b/libcxx/include/regex
index bbc21e2..9bbc3a6 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -2120,7 +2120,7 @@ public:
__ranges_.push_back(
std::make_pair(__traits_.transform(__b.begin(), __b.end()), __traits_.transform(__e.begin(), __e.end())));
} else {
- if (__b.size() != 1 || __e.size() != 1)
+ if (__b.size() != 1 || __e.size() != 1 || char_traits<typename string_type::value_type>::lt(__e[0], __b[0]))
std::__throw_regex_error<regex_constants::error_range>();
if (__icase_) {
__b[0] = __traits_.translate_nocase(__b[0]);
diff --git a/libcxx/include/scoped_allocator b/libcxx/include/scoped_allocator
index 7b8a9c9..74effc5 100644
--- a/libcxx/include/scoped_allocator
+++ b/libcxx/include/scoped_allocator
@@ -434,10 +434,10 @@ public:
piecewise_construct,
__transform_tuple(typename __uses_alloc_ctor< _T1, inner_allocator_type&, _Args1... >::type(),
std::move(__x),
- typename __make_tuple_indices<sizeof...(_Args1)>::type{}),
+ __make_index_sequence<sizeof...(_Args1)>()),
__transform_tuple(typename __uses_alloc_ctor< _T2, inner_allocator_type&, _Args2... >::type(),
std::move(__y),
- typename __make_tuple_indices<sizeof...(_Args2)>::type{}));
+ __make_index_sequence<sizeof...(_Args2)>()));
}
template <class _T1, class _T2>
@@ -503,20 +503,20 @@ private:
template <class... _Args, size_t... _Idx>
_LIBCPP_HIDE_FROM_ABI tuple<_Args&&...>
- __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
+ __transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t, __index_sequence<_Idx...>) {
return std::forward_as_tuple(std::get<_Idx>(std::move(__t))...);
}
template <class... _Args, size_t... _Idx>
_LIBCPP_HIDE_FROM_ABI tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>
- __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
+ __transform_tuple(integral_constant<int, 1>, tuple<_Args...>&& __t, __index_sequence<_Idx...>) {
using _Tup = tuple<allocator_arg_t, inner_allocator_type&, _Args&&...>;
return _Tup(allocator_arg, inner_allocator(), std::get<_Idx>(std::move(__t))...);
}
template <class... _Args, size_t... _Idx>
_LIBCPP_HIDE_FROM_ABI tuple<_Args&&..., inner_allocator_type&>
- __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __tuple_indices<_Idx...>) {
+ __transform_tuple(integral_constant<int, 2>, tuple<_Args...>&& __t, __index_sequence<_Idx...>) {
using _Tup = tuple<_Args&&..., inner_allocator_type&>;
return _Tup(std::get<_Idx>(std::move(__t))..., inner_allocator());
}
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index 75021f0..662d926 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -229,7 +229,6 @@ template <class... Types>
# include <__tuple/make_tuple_types.h>
# include <__tuple/sfinae_helpers.h>
# include <__tuple/tuple_element.h>
-# include <__tuple/tuple_indices.h>
# include <__tuple/tuple_like_ext.h>
# include <__tuple/tuple_size.h>
# include <__tuple/tuple_types.h>
@@ -457,15 +456,15 @@ struct __tuple_impl;
template <size_t... _Indx, class... _Tp>
struct _LIBCPP_DECLSPEC_EMPTY_BASES
- __tuple_impl<__tuple_indices<_Indx...>, _Tp...> : public __tuple_leaf<_Indx, _Tp>... {
+ __tuple_impl<__index_sequence<_Indx...>, _Tp...> : public __tuple_leaf<_Indx, _Tp>... {
_LIBCPP_HIDE_FROM_ABI constexpr __tuple_impl() noexcept(
__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
template <size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(
- __tuple_indices<_Uf...>,
+ __index_sequence<_Uf...>,
__tuple_types<_Tf...>,
- __tuple_indices<_Ul...>,
+ __index_sequence<_Ul...>,
__tuple_types<_Tl...>,
_Up&&... __u) noexcept(__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
__all<is_nothrow_default_constructible<_Tl>::value...>::value)
@@ -475,9 +474,9 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(
allocator_arg_t,
const _Alloc& __a,
- __tuple_indices<_Uf...>,
+ __index_sequence<_Uf...>,
__tuple_types<_Tf...>,
- __tuple_indices<_Ul...>,
+ __index_sequence<_Ul...>,
__tuple_types<_Tl...>,
_Up&&... __u)
: __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a, std::forward<_Up>(__u))...,
@@ -518,19 +517,19 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES
template <class _Dest, class _Source, size_t... _Np>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
-__memberwise_copy_assign(_Dest& __dest, _Source const& __source, __tuple_indices<_Np...>) {
+__memberwise_copy_assign(_Dest& __dest, _Source const& __source, __index_sequence<_Np...>) {
std::__swallow(((std::get<_Np>(__dest) = std::get<_Np>(__source)), void(), 0)...);
}
template <class _Dest, class _Source, class... _Up, size_t... _Np>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
-__memberwise_forward_assign(_Dest& __dest, _Source&& __source, __tuple_types<_Up...>, __tuple_indices<_Np...>) {
+__memberwise_forward_assign(_Dest& __dest, _Source&& __source, __tuple_types<_Up...>, __index_sequence<_Np...>) {
std::__swallow(((std::get<_Np>(__dest) = std::forward<_Up>(std::get<_Np>(__source))), void(), 0)...);
}
template <class... _Tp>
class _LIBCPP_NO_SPECIALIZATIONS tuple {
- typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> _BaseT;
+ typedef __tuple_impl<__make_index_sequence<sizeof...(_Tp)>, _Tp...> _BaseT;
_BaseT __base_;
@@ -568,9 +567,9 @@ public:
tuple(allocator_arg_t, _Alloc const& __a)
: __base_(allocator_arg_t(),
__a,
- __tuple_indices<>(),
+ __index_sequence<>(),
__tuple_types<>(),
- typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
+ __make_index_sequence<sizeof...(_Tp)>(),
__tuple_types<_Tp...>()) {}
// tuple(const T&...) constructors (including allocator_arg_t variants)
@@ -579,10 +578,10 @@ public:
_LIBCPP_HIDE_FROM_ABI
_LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
tuple(const _Tp&... __t) noexcept(_And<is_nothrow_copy_constructible<_Tp>...>::value)
- : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
- typename __make_tuple_indices<0>::type(),
- typename __make_tuple_types<tuple, 0>::type(),
+ : __base_(__make_index_sequence<sizeof...(_Tp)>(),
+ __tuple_types<_Tp...>(),
+ __index_sequence<>(),
+ __tuple_types<>(),
__t...) {}
template <class _Alloc,
@@ -593,10 +592,10 @@ public:
tuple(allocator_arg_t, const _Alloc& __a, const _Tp&... __t)
: __base_(allocator_arg_t(),
__a,
- typename __make_tuple_indices<sizeof...(_Tp)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
- typename __make_tuple_indices<0>::type(),
- typename __make_tuple_types<tuple, 0>::type(),
+ __make_index_sequence<sizeof...(_Tp)>(),
+ __tuple_types<_Tp...>(),
+ __index_sequence<>(),
+ __tuple_types<>(),
__t...) {}
// tuple(U&& ...) constructors (including allocator_arg_t variants)
@@ -616,10 +615,10 @@ public:
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
tuple(_Up&&... __u) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
- : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
- typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
+ : __base_(__make_index_sequence<sizeof...(_Up)>(),
+ __tuple_types<_Tp...>(),
+ __index_sequence<>(),
+ __tuple_types<>(),
std::forward<_Up>(__u)...) {}
template <class _Alloc,
@@ -630,10 +629,10 @@ public:
tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
: __base_(allocator_arg_t(),
__a,
- typename __make_tuple_indices<sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
- typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
- typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
+ __make_index_sequence<sizeof...(_Up)>(),
+ __tuple_types<_Tp...>(),
+ __index_sequence<>(),
+ __tuple_types<>(),
std::forward<_Up>(__u)...) {}
// Copy and move constructors (including the allocator_arg_t variants)
@@ -838,7 +837,7 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple) noexcept(
_And<is_nothrow_copy_assignable<_Tp>...>::value) {
- std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ std::__memberwise_copy_assign(*this, __tuple, __make_index_sequence<sizeof...(_Tp)>());
return *this;
}
@@ -846,7 +845,7 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple const& __tuple) const
requires(_And<is_copy_assignable<const _Tp>...>::value)
{
- std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ std::__memberwise_copy_assign(*this, __tuple, __make_index_sequence<sizeof...(_Tp)>());
return *this;
}
@@ -854,7 +853,7 @@ public:
requires(_And<is_assignable<const _Tp&, _Tp>...>::value)
{
std::__memberwise_forward_assign(
- *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ *this, std::move(__tuple), __tuple_types<_Tp...>(), __make_index_sequence<sizeof...(_Tp)>());
return *this;
}
# endif // _LIBCPP_STD_VER >= 23
@@ -863,7 +862,7 @@ public:
operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple) noexcept(
_And<is_nothrow_move_assignable<_Tp>...>::value) {
std::__memberwise_forward_assign(
- *this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ *this, std::move(__tuple), __tuple_types<_Tp...>(), __make_index_sequence<sizeof...(_Tp)>());
return *this;
}
@@ -873,7 +872,7 @@ public:
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
operator=(tuple<_Up...> const& __tuple) noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) {
- std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ std::__memberwise_copy_assign(*this, __tuple, __make_index_sequence<sizeof...(_Tp)>());
return *this;
}
@@ -883,7 +882,7 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
operator=(tuple<_Up...>&& __tuple) noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) {
std::__memberwise_forward_assign(
- *this, std::move(__tuple), __tuple_types<_Up...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ *this, std::move(__tuple), __tuple_types<_Up...>(), __make_index_sequence<sizeof...(_Tp)>());
return *this;
}
@@ -892,7 +891,7 @@ public:
enable_if_t< _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
is_assignable<const _Tp&, const _UTypes&>...>::value>* = nullptr>
_LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(const tuple<_UTypes...>& __u) const {
- std::__memberwise_copy_assign(*this, __u, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ std::__memberwise_copy_assign(*this, __u, __make_index_sequence<sizeof...(_Tp)>());
return *this;
}
@@ -900,8 +899,7 @@ public:
enable_if_t< _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>,
is_assignable<const _Tp&, _UTypes>...>::value>* = nullptr>
_LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple<_UTypes...>&& __u) const {
- std::__memberwise_forward_assign(
- *this, __u, __tuple_types<_UTypes...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ std::__memberwise_forward_assign(*this, __u, __tuple_types<_UTypes...>(), __make_index_sequence<sizeof...(_Tp)>());
return *this;
}
# endif // _LIBCPP_STD_VER >= 23
@@ -967,7 +965,7 @@ public:
__enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up const&>... >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
operator=(array<_Up, _Np> const& __array) noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) {
- std::__memberwise_copy_assign(*this, __array, typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ std::__memberwise_copy_assign(*this, __array, __make_index_sequence<sizeof...(_Tp)>());
return *this;
}
@@ -979,10 +977,7 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
operator=(array<_Up, _Np>&& __array) noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) {
std::__memberwise_forward_assign(
- *this,
- std::move(__array),
- __tuple_types<_If<true, _Up, _Tp>...>(),
- typename __make_tuple_indices<sizeof...(_Tp)>::type());
+ *this, std::move(__array), __tuple_types<_If<true, _Up, _Tp>...>(), __make_index_sequence<sizeof...(_Tp)>());
return *this;
}
@@ -1291,17 +1286,17 @@ template <class _Rp, class _Indices, class _Tuple0, class... _Tuples>
struct __tuple_cat_return_ref_imp;
template <class... _Types, size_t... _I0, class _Tuple0>
-struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0> {
+struct __tuple_cat_return_ref_imp<tuple<_Types...>, __index_sequence<_I0...>, _Tuple0> {
using _T0 _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tuple0>;
typedef tuple<_Types..., __copy_cvref_t<_Tuple0, typename tuple_element<_I0, _T0>::type>&&...> type;
};
template <class... _Types, size_t... _I0, class _Tuple0, class _Tuple1, class... _Tuples>
-struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0, _Tuple1, _Tuples...>
+struct __tuple_cat_return_ref_imp<tuple<_Types...>, __index_sequence<_I0...>, _Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_ref_imp<
tuple<_Types...,
__copy_cvref_t<_Tuple0, typename tuple_element<_I0, __libcpp_remove_reference_t<_Tuple0>>::type>&&...>,
- typename __make_tuple_indices<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>::type,
+ __make_index_sequence<tuple_size<__libcpp_remove_reference_t<_Tuple1> >::value>,
_Tuple1,
_Tuples...> {};
@@ -1309,7 +1304,7 @@ template <class _Tuple0, class... _Tuples>
struct __tuple_cat_return_ref
: public __tuple_cat_return_ref_imp<
tuple<>,
- typename __make_tuple_indices< tuple_size<__libcpp_remove_reference_t<_Tuple0> >::value >::type,
+ __make_index_sequence< tuple_size<__libcpp_remove_reference_t<_Tuple0> >::value >,
_Tuple0,
_Tuples...> {};
@@ -1317,7 +1312,7 @@ template <class _Types, class _I0, class _J0>
struct __tuple_cat;
template <class... _Types, size_t... _I0, size_t... _J0>
-struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> > {
+struct __tuple_cat<tuple<_Types...>, __index_sequence<_I0...>, __index_sequence<_J0...>> {
template <class _Tuple0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
@@ -1335,8 +1330,8 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
using _T0 _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tuple0>;
using _T1 _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tuple1>;
return __tuple_cat<tuple<_Types..., __copy_cvref_t<_Tuple0, typename tuple_element<_J0, _T0>::type>&&...>,
- typename __make_tuple_indices<sizeof...(_Types) + tuple_size<_T0>::value>::type,
- typename __make_tuple_indices<tuple_size<_T1>::value>::type>()(
+ __make_index_sequence<sizeof...(_Types) + tuple_size<_T0>::value>,
+ __make_index_sequence<tuple_size<_T1>::value>>()(
std::forward_as_tuple(
std::forward<_Types>(std::get<_I0>(__t))..., std::get<_J0>(std::forward<_Tuple0>(__t0))...),
std::forward<_Tuple1>(__t1),
@@ -1346,7 +1341,7 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
template <class _TupleDst, class _TupleSrc, size_t... _Indices>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _TupleDst
-__tuple_cat_select_element_wise(_TupleSrc&& __src, __tuple_indices<_Indices...>) {
+__tuple_cat_select_element_wise(_TupleSrc&& __src, __index_sequence<_Indices...>) {
static_assert(tuple_size<_TupleDst>::value == tuple_size<_TupleSrc>::value,
"misuse of __tuple_cat_select_element_wise with tuples of different sizes");
return _TupleDst(std::get<_Indices>(std::forward<_TupleSrc>(__src))...);
@@ -1357,10 +1352,10 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __tuple_cat_
tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) {
using _T0 _LIBCPP_NODEBUG = __libcpp_remove_reference_t<_Tuple0>;
using _TRet _LIBCPP_NODEBUG = typename __tuple_cat_return<_Tuple0, _Tuples...>::type;
- using _T0Indices _LIBCPP_NODEBUG = typename __make_tuple_indices<tuple_size<_T0>::value>::type;
- using _TRetIndices _LIBCPP_NODEBUG = typename __make_tuple_indices<tuple_size<_TRet>::value>::type;
+ using _T0Indices _LIBCPP_NODEBUG = __make_index_sequence<tuple_size<_T0>::value>;
+ using _TRetIndices _LIBCPP_NODEBUG = __make_index_sequence<tuple_size<_TRet>::value>;
return std::__tuple_cat_select_element_wise<_TRet>(
- __tuple_cat<tuple<>, __tuple_indices<>, _T0Indices>()(
+ __tuple_cat<tuple<>, __index_sequence<>, _T0Indices>()(
tuple<>(), std::forward<_Tuple0>(__t0), std::forward<_Tuples>(__tpls)...),
_TRetIndices());
}
@@ -1376,7 +1371,7 @@ struct uses_allocator<tuple<_Tp...>, _Alloc> : true_type {};
// clang-format off
template <class _Fn, class _Tuple, size_t... _Id>
inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto)
-__apply_tuple_impl(_Fn&& __f, _Tuple&& __t, __tuple_indices<_Id...>)
+__apply_tuple_impl(_Fn&& __f, _Tuple&& __t, index_sequence<_Id...>)
_LIBCPP_NOEXCEPT_RETURN(std::__invoke(std::forward<_Fn>(__f), std::get<_Id>(std::forward<_Tuple>(__t))...))
template <class _Fn, class _Tuple>
@@ -1384,28 +1379,28 @@ inline _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) apply(_Fn&& __f, _Tuple&&
_LIBCPP_NOEXCEPT_RETURN(std::__apply_tuple_impl(
std::forward<_Fn>(__f),
std::forward<_Tuple>(__t),
- typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
+ make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>()))
#if _LIBCPP_STD_VER >= 20
template <class _Tp, class _Tuple, size_t... _Idx>
-inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>)
+inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, index_sequence<_Idx...>)
noexcept(noexcept(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...)))
requires is_constructible_v<_Tp, decltype(std::get<_Idx>(std::forward<_Tuple>(__t)))...> {
return _Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...);
}
#else
template <class _Tp, class _Tuple, size_t... _Idx>
-inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>,
+inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, index_sequence<_Idx...>,
enable_if_t<is_constructible_v<_Tp, decltype(std::get<_Idx>(std::forward<_Tuple>(__t)))...>> * = nullptr)
_LIBCPP_NOEXCEPT_RETURN(_Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...))
#endif // _LIBCPP_STD_VER >= 20
template <class _Tp, class _Tuple,
- class _Seq = typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type, class = void>
+ class _Seq = make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>, class = void>
inline constexpr bool __can_make_from_tuple = false;
template <class _Tp, class _Tuple, size_t... _Idx>
-inline constexpr bool __can_make_from_tuple<_Tp, _Tuple, __tuple_indices<_Idx...>,
+inline constexpr bool __can_make_from_tuple<_Tp, _Tuple, index_sequence<_Idx...>,
enable_if_t<is_constructible_v<_Tp, decltype(std::get<_Idx>(std::declval<_Tuple>()))...>>> = true;
// Based on LWG3528(https://wg21.link/LWG3528) and http://eel.is/c++draft/description#structure.requirements-9,
@@ -1420,7 +1415,7 @@ template <class _Tp, class _Tuple, class = enable_if_t<__can_make_from_tuple<_Tp
#endif // _LIBCPP_STD_VER >= 20
inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp make_from_tuple(_Tuple&& __t)
_LIBCPP_NOEXCEPT_RETURN(std::__make_from_tuple_impl<_Tp>(
- std::forward<_Tuple>(__t), typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{}))
+ std::forward<_Tuple>(__t), make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>()))
# undef _LIBCPP_NOEXCEPT_RETURN
# endif // _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/variant b/libcxx/include/variant
index ede9f48..9beef14 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -1127,14 +1127,14 @@ template <class _IdxSeq>
struct __make_overloads_imp;
template <size_t... _Idx>
-struct __make_overloads_imp<__tuple_indices<_Idx...> > {
+struct __make_overloads_imp<index_sequence<_Idx...> > {
template <class... _Types>
using _Apply _LIBCPP_NODEBUG = __all_overloads<__overload<_Types, _Idx>...>;
};
template <class... _Types>
using _MakeOverloads _LIBCPP_NODEBUG =
- typename __make_overloads_imp< __make_indices_imp<sizeof...(_Types), 0> >::template _Apply<_Types...>;
+ typename __make_overloads_imp<make_index_sequence<sizeof...(_Types)>>::template _Apply<_Types...>;
template <class _Tp, class... _Types>
using __best_match_t _LIBCPP_NODEBUG = typename invoke_result_t<_MakeOverloads<_Types...>, _Tp, _Tp>::type;