aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/include/stack
diff options
context:
space:
mode:
authorhiddenpath <hiddenpath@yandex-team.com>2024-02-21 23:16:42 +0300
committerhiddenpath <hiddenpath@yandex-team.com>2024-02-21 23:33:25 +0300
commit9052eb5cc304b8da8885fc4e3364ebddc16945f3 (patch)
tree3c252f6161dd0745c7732d74c9304c000645ab47 /contrib/libs/cxxsupp/libcxx/include/stack
parentf5eb715f103692e7c7536e13bef3f281fd78e5e7 (diff)
downloadydb-9052eb5cc304b8da8885fc4e3364ebddc16945f3.tar.gz
Update libcxx to llvmorg-17.0.6
Update libcxx to llvmorg-17.0.6 c871ef572c71b4fef22d4a9e65bcebc57e625aea
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/stack')
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/stack95
1 files changed, 82 insertions, 13 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/stack b/contrib/libs/cxxsupp/libcxx/include/stack
index d653d1bc7e..437f57d76b 100644
--- a/contrib/libs/cxxsupp/libcxx/include/stack
+++ b/contrib/libs/cxxsupp/libcxx/include/stack
@@ -42,6 +42,7 @@ public:
explicit stack(const container_type& c);
explicit stack(container_type&& c);
template <class InputIterator> stack(InputIterator first, InputIterator last); // since C++23
+ template<container-compatible-range<T> R> stack(from_range_t, R&& rg); // since C++23
template <class Alloc> explicit stack(const Alloc& a);
template <class Alloc> stack(const container_type& c, const Alloc& a);
template <class Alloc> stack(container_type&& c, const Alloc& a);
@@ -49,6 +50,8 @@ public:
template <class Alloc> stack(stack&& c, const Alloc& a);
template<class InputIterator, class Alloc>
stack(InputIterator first, InputIterator last, const Alloc&); // since C++23
+ template<container-compatible-range<T> R, class Alloc>
+ stack(from_range_t, R&& rg, const Alloc&); // since C++23
bool empty() const;
size_type size() const;
@@ -57,6 +60,8 @@ public:
void push(const value_type& x);
void push(value_type&& x);
+ template<container-compatible-range<T> R>
+ void push_range(R&& rg); // C++23
template <class... Args> reference emplace(Args&&... args); // reference in C++17
void pop();
@@ -69,6 +74,9 @@ template<class Container>
template<class InputIterator>
stack(InputIterator, InputIterator) -> stack<iter-value-type<InputIterator>>; // since C++23
+template<ranges::input_range R>
+ stack(from_range_t, R&&) -> stack<ranges::range_value_t<R>>; // since C++23
+
template<class Container, class Allocator>
stack(Container, Allocator) -> stack<typename Container::value_type, Container>; // C++17
@@ -77,6 +85,10 @@ template<class InputIterator, class Allocator>
-> stack<iter-value-type<InputIterator>,
deque<iter-value-type<InputIterator>, Allocator>>; // since C++23
+template<ranges::input_range R, class Allocator>
+ stack(from_range_t, R&&, Allocator)
+ -> stack<ranges::range_value_t<R>, deque<ranges::range_value_t<R>, Allocator>>; // since C++23
+
template <class T, class Container>
bool operator==(const stack<T, Container>& x, const stack<T, Container>& y);
template <class T, class Container>
@@ -89,6 +101,9 @@ template <class T, class Container>
bool operator>=(const stack<T, Container>& x, const stack<T, Container>& y);
template <class T, class Container>
bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
+template<class T, three_way_comparable Container>
+ compare_three_way_result_t<Container>
+ operator<=>(const stack<T, Container>& x, const stack<T, Container>& y); // since C++20
template <class T, class Container>
void swap(stack<T, Container>& x, stack<T, Container>& y)
@@ -98,13 +113,19 @@ template <class T, class Container>
*/
+#include <__algorithm/ranges_copy.h>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__iterator/back_insert_iterator.h>
#include <__iterator/iterator_traits.h>
#include <__memory/uses_allocator.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__ranges/container_compatible_range.h>
+#include <__ranges/from_range.h>
+#include <__type_traits/is_same.h>
#include <__utility/forward.h>
#include <deque>
-#include <type_traits>
#include <version>
// standard-mandated includes
@@ -204,18 +225,30 @@ public:
: c(_VSTD::move(__s.c), __a) {}
#endif // _LIBCPP_CXX03_LANG
-#if _LIBCPP_STD_VER > 20
+#if _LIBCPP_STD_VER >= 23
template <class _InputIterator,
- class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>>
+ class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
_LIBCPP_HIDE_FROM_ABI
stack(_InputIterator __first, _InputIterator __last) : c(__first, __last) {}
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ stack(from_range_t, _Range&& __range) : c(from_range, std::forward<_Range>(__range)) {}
+
template <class _InputIterator,
class _Alloc,
- class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
+ class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
_LIBCPP_HIDE_FROM_ABI
stack(_InputIterator __first, _InputIterator __last, const _Alloc& __alloc) : c(__first, __last, __alloc) {}
+
+ template <_ContainerCompatibleRange<_Tp> _Range,
+ class _Alloc,
+ class = __enable_if_t<uses_allocator<container_type, _Alloc>::value>>
+ _LIBCPP_HIDE_FROM_ABI
+ stack(from_range_t, _Range&& __range, const _Alloc& __alloc)
+ : c(from_range, std::forward<_Range>(__range), __alloc) {}
+
#endif
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
@@ -233,9 +266,23 @@ public:
_LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
+#if _LIBCPP_STD_VER >= 23
+ template <_ContainerCompatibleRange<_Tp> _Range>
+ _LIBCPP_HIDE_FROM_ABI
+ void push_range(_Range&& __range) {
+ if constexpr (requires (container_type& __c) {
+ __c.append_range(std::forward<_Range>(__range));
+ }) {
+ c.append_range(std::forward<_Range>(__range));
+ } else {
+ ranges::copy(std::forward<_Range>(__range), std::back_inserter(c));
+ }
+ }
+#endif
+
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
-#if _LIBCPP_STD_VER > 14
+#if _LIBCPP_STD_VER >= 17
decltype(auto) emplace(_Args&&... __args)
{ return c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#else
@@ -257,18 +304,18 @@ public:
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
- template <class T1, class _C1>
+ template <class _T1, class _OtherContainer>
friend
bool
- operator==(const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
+ operator==(const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
- template <class T1, class _C1>
+ template <class _T1, class _OtherContainer>
friend
bool
- operator< (const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
+ operator< (const stack<_T1, _OtherContainer>& __x, const stack<_T1, _OtherContainer>& __y);
};
-#if _LIBCPP_STD_VER > 14
+#if _LIBCPP_STD_VER >= 17
template<class _Container,
class = enable_if_t<!__is_allocator<_Container>::value>
>
@@ -284,18 +331,28 @@ stack(_Container, _Alloc)
-> stack<typename _Container::value_type, _Container>;
#endif
-#if _LIBCPP_STD_VER > 20
+#if _LIBCPP_STD_VER >= 23
template<class _InputIterator,
- class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>>
+ class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>>
stack(_InputIterator, _InputIterator)
-> stack<__iter_value_type<_InputIterator>>;
+template <ranges::input_range _Range>
+stack(from_range_t, _Range&&) -> stack<ranges::range_value_t<_Range>>;
+
template<class _InputIterator,
class _Alloc,
- class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
+ class = __enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
class = __enable_if_t<__is_allocator<_Alloc>::value>>
stack(_InputIterator, _InputIterator, _Alloc)
-> stack<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
+
+template <ranges::input_range _Range,
+ class _Alloc,
+ class = __enable_if_t<__is_allocator<_Alloc>::value>>
+stack(from_range_t, _Range&&, _Alloc)
+ -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
+
#endif
template <class _Tp, class _Container>
@@ -346,6 +403,17 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
return !(__y < __x);
}
+#if _LIBCPP_STD_VER >= 20
+
+template <class _Tp, three_way_comparable _Container>
+_LIBCPP_HIDE_FROM_ABI compare_three_way_result_t<_Container>
+operator<=>(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) {
+ // clang 16 bug: declaring `friend operator<=>` causes "use of overloaded operator '*' is ambiguous" errors
+ return __x.__get_container() <=> __y.__get_container();
+}
+
+#endif
+
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
__enable_if_t<__is_swappable<_Container>::value, void>
@@ -366,6 +434,7 @@ _LIBCPP_END_NAMESPACE_STD
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <concepts>
# include <functional>
+# include <type_traits>
#endif
#endif // _LIBCPP_STACK