mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
update libcxx to llvm 16
This commit is contained in:
parent
85be0b8c65
commit
1eaf180dd0
770 changed files with 27347 additions and 15411 deletions
|
|
@ -23,7 +23,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Iter, class _Sent, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter
|
||||
__adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) {
|
||||
if (__first == __last)
|
||||
return __first;
|
||||
|
|
@ -37,16 +37,15 @@ __adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) {
|
|||
}
|
||||
|
||||
template <class _ForwardIterator, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
|
||||
adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) {
|
||||
return std::__adjacent_find(std::move(__first), std::move(__last), __pred);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
|
||||
adjacent_find(_ForwardIterator __first, _ForwardIterator __last) {
|
||||
typedef typename iterator_traits<_ForwardIterator>::value_type __v;
|
||||
return std::adjacent_find(std::move(__first), std::move(__last), __equal_to<__v>());
|
||||
return std::adjacent_find(std::move(__first), std::move(__last), __equal_to());
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
|
|
|||
2
lib/libcxx/include/__algorithm/all_of.h
vendored
2
lib/libcxx/include/__algorithm/all_of.h
vendored
|
|
@ -19,7 +19,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Predicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
|
||||
for (; __first != __last; ++__first)
|
||||
if (!__pred(*__first))
|
||||
|
|
|
|||
2
lib/libcxx/include/__algorithm/any_of.h
vendored
2
lib/libcxx/include/__algorithm/any_of.h
vendored
|
|
@ -19,7 +19,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Predicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
|
||||
for (; __first != __last; ++__first)
|
||||
if (__pred(*__first))
|
||||
|
|
|
|||
|
|
@ -23,18 +23,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
template <class _ForwardIterator, class _Tp, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
{
|
||||
using _Comp_ref = typename __comp_ref_type<_Compare>::type;
|
||||
__first = std::lower_bound<_ForwardIterator, _Tp, _Comp_ref>(__first, __last, __value, __comp);
|
||||
__first = std::lower_bound<_ForwardIterator, _Tp, __comp_ref_type<_Compare> >(__first, __last, __value, __comp);
|
||||
return __first != __last && !__comp(__value, *__first);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
|
||||
{
|
||||
|
|
|
|||
50
lib/libcxx/include/__algorithm/comp.h
vendored
50
lib/libcxx/include/__algorithm/comp.h
vendored
|
|
@ -17,73 +17,47 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// I'd like to replace these with _VSTD::equal_to<void>, but can't because:
|
||||
// * That only works with C++14 and later, and
|
||||
// * We haven't included <functional> here.
|
||||
template <class _T1, class _T2 = _T1>
|
||||
struct __equal_to
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _T1& __x, const _T2& __y) const {return __x == __y;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _T2& __x, const _T1& __y) const {return __x == __y;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _T2& __x, const _T2& __y) const {return __x == __y;}
|
||||
};
|
||||
|
||||
template <class _T1>
|
||||
struct __equal_to<_T1, _T1>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
|
||||
};
|
||||
|
||||
template <class _T1>
|
||||
struct __equal_to<const _T1, _T1>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
|
||||
};
|
||||
|
||||
template <class _T1>
|
||||
struct __equal_to<_T1, const _T1>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
|
||||
struct __equal_to {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool operator()(const _T1& __x, const _T2& __y) const {
|
||||
return __x == __y;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _T1, class _T2 = _T1>
|
||||
struct __less
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator()(const _T1& __x, const _T2& __y) const {return __x < __y;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator()(const _T2& __x, const _T1& __y) const {return __x < __y;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator()(const _T2& __x, const _T2& __y) const {return __x < __y;}
|
||||
};
|
||||
|
||||
template <class _T1>
|
||||
struct __less<_T1, _T1>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
|
||||
};
|
||||
|
||||
template <class _T1>
|
||||
struct __less<const _T1, _T1>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
|
||||
};
|
||||
|
||||
template <class _T1>
|
||||
struct __less<_T1, const _T1>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
|
||||
};
|
||||
|
||||
|
|
|
|||
27
lib/libcxx/include/__algorithm/comp_ref_type.h
vendored
27
lib/libcxx/include/__algorithm/comp_ref_type.h
vendored
|
|
@ -23,11 +23,11 @@ template <class _Compare>
|
|||
struct __debug_less
|
||||
{
|
||||
_Compare &__comp_;
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
__debug_less(_Compare& __c) : __comp_(__c) {}
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator()(const _Tp& __x, const _Up& __y)
|
||||
{
|
||||
bool __r = __comp_(__x, __y);
|
||||
|
|
@ -37,7 +37,7 @@ struct __debug_less
|
|||
}
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator()(_Tp& __x, _Up& __y)
|
||||
{
|
||||
bool __r = __comp_(__x, __y);
|
||||
|
|
@ -47,10 +47,10 @@ struct __debug_less
|
|||
}
|
||||
|
||||
template <class _LHS, class _RHS>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
decltype((void)declval<_Compare&>()(
|
||||
declval<_LHS &>(), declval<_RHS &>()))
|
||||
decltype((void)std::declval<_Compare&>()(
|
||||
std::declval<_LHS &>(), std::declval<_RHS &>()))
|
||||
__do_compare_assert(int, _LHS & __l, _RHS & __r) {
|
||||
_LIBCPP_DEBUG_ASSERT(!__comp_(__l, __r),
|
||||
"Comparator does not induce a strict weak ordering");
|
||||
|
|
@ -59,21 +59,20 @@ struct __debug_less
|
|||
}
|
||||
|
||||
template <class _LHS, class _RHS>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __do_compare_assert(long, _LHS &, _RHS &) {}
|
||||
};
|
||||
|
||||
template <class _Comp>
|
||||
struct __comp_ref_type {
|
||||
// Pass the comparator by lvalue reference. Or in debug mode, using a
|
||||
// debugging wrapper that stores a reference.
|
||||
// Pass the comparator by lvalue reference. Or in debug mode, using a
|
||||
// debugging wrapper that stores a reference.
|
||||
#ifdef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
typedef __debug_less<_Comp> type;
|
||||
template <class _Comp>
|
||||
using __comp_ref_type = __debug_less<_Comp>;
|
||||
#else
|
||||
typedef _Comp& type;
|
||||
template <class _Comp>
|
||||
using __comp_ref_type = _Comp&;
|
||||
#endif
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
|
|||
162
lib/libcxx/include/__algorithm/copy.h
vendored
162
lib/libcxx/include/__algorithm/copy.h
vendored
|
|
@ -9,100 +9,118 @@
|
|||
#ifndef _LIBCPP___ALGORITHM_COPY_H
|
||||
#define _LIBCPP___ALGORITHM_COPY_H
|
||||
|
||||
#include <__algorithm/unwrap_iter.h>
|
||||
#include <__algorithm/unwrap_range.h>
|
||||
#include <__algorithm/copy_move_common.h>
|
||||
#include <__algorithm/iterator_operations.h>
|
||||
#include <__algorithm/min.h>
|
||||
#include <__config>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__iterator/reverse_iterator.h>
|
||||
#include <__iterator/segmented_iterator.h>
|
||||
#include <__type_traits/common_type.h>
|
||||
#include <__utility/move.h>
|
||||
#include <__utility/pair.h>
|
||||
#include <cstring>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// copy
|
||||
template <class, class _InIter, class _Sent, class _OutIter>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter> __copy(_InIter, _Sent, _OutIter);
|
||||
|
||||
template <class _InIter, class _Sent, class _OutIter>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
pair<_InIter, _OutIter> __copy_impl(_InIter __first, _Sent __last, _OutIter __result) {
|
||||
while (__first != __last) {
|
||||
*__result = *__first;
|
||||
++__first;
|
||||
++__result;
|
||||
template <class _AlgPolicy>
|
||||
struct __copy_loop {
|
||||
template <class _InIter, class _Sent, class _OutIter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _Sent __last, _OutIter __result) const {
|
||||
while (__first != __last) {
|
||||
*__result = *__first;
|
||||
++__first;
|
||||
++__result;
|
||||
}
|
||||
|
||||
return std::make_pair(std::move(__first), std::move(__result));
|
||||
}
|
||||
return pair<_InIter, _OutIter>(std::move(__first), std::move(__result));
|
||||
}
|
||||
|
||||
template <class _InValueT,
|
||||
class _OutValueT,
|
||||
class = __enable_if_t<is_same<typename remove_const<_InValueT>::type, _OutValueT>::value
|
||||
&& is_trivially_copy_assignable<_OutValueT>::value> >
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
pair<_InValueT*, _OutValueT*> __copy_impl(_InValueT* __first, _InValueT* __last, _OutValueT* __result) {
|
||||
if (__libcpp_is_constant_evaluated()
|
||||
// TODO: Remove this once GCC supports __builtin_memmove during constant evaluation
|
||||
#ifndef _LIBCPP_COMPILER_GCC
|
||||
&& !is_trivially_copyable<_InValueT>::value
|
||||
#endif
|
||||
)
|
||||
return std::__copy_impl<_InValueT*, _InValueT*, _OutValueT*>(__first, __last, __result);
|
||||
const size_t __n = static_cast<size_t>(__last - __first);
|
||||
if (__n > 0)
|
||||
::__builtin_memmove(__result, __first, __n * sizeof(_OutValueT));
|
||||
return std::make_pair(__first + __n, __result + __n);
|
||||
}
|
||||
template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
|
||||
using _Traits = __segmented_iterator_traits<_InIter>;
|
||||
auto __sfirst = _Traits::__segment(__first);
|
||||
auto __slast = _Traits::__segment(__last);
|
||||
if (__sfirst == __slast) {
|
||||
auto __iters = std::__copy<_AlgPolicy>(_Traits::__local(__first), _Traits::__local(__last), std::move(__result));
|
||||
return std::make_pair(__last, std::move(__iters.second));
|
||||
}
|
||||
|
||||
template <class _InIter, class _OutIter,
|
||||
__enable_if_t<is_same<typename remove_const<__iter_value_type<_InIter> >::type, __iter_value_type<_OutIter> >::value
|
||||
&& __is_cpp17_contiguous_iterator<typename _InIter::iterator_type>::value
|
||||
&& __is_cpp17_contiguous_iterator<typename _OutIter::iterator_type>::value
|
||||
&& is_trivially_copy_assignable<__iter_value_type<_OutIter> >::value
|
||||
&& __is_reverse_iterator<_InIter>::value
|
||||
&& __is_reverse_iterator<_OutIter>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
pair<_InIter, _OutIter>
|
||||
__copy_impl(_InIter __first, _InIter __last, _OutIter __result) {
|
||||
auto __first_base = std::__unwrap_iter(__first.base());
|
||||
auto __last_base = std::__unwrap_iter(__last.base());
|
||||
auto __result_base = std::__unwrap_iter(__result.base());
|
||||
auto __result_first = __result_base - (__first_base - __last_base);
|
||||
std::__copy_impl(__last_base, __first_base, __result_first);
|
||||
return std::make_pair(__last, _OutIter(std::__rewrap_iter(__result.base(), __result_first)));
|
||||
}
|
||||
__result = std::__copy<_AlgPolicy>(_Traits::__local(__first), _Traits::__end(__sfirst), std::move(__result)).second;
|
||||
++__sfirst;
|
||||
while (__sfirst != __slast) {
|
||||
__result =
|
||||
std::__copy<_AlgPolicy>(_Traits::__begin(__sfirst), _Traits::__end(__sfirst), std::move(__result)).second;
|
||||
++__sfirst;
|
||||
}
|
||||
__result =
|
||||
std::__copy<_AlgPolicy>(_Traits::__begin(__sfirst), _Traits::__local(__last), std::move(__result)).second;
|
||||
return std::make_pair(__last, std::move(__result));
|
||||
}
|
||||
|
||||
template <class _InIter, class _Sent, class _OutIter,
|
||||
__enable_if_t<!(is_copy_constructible<_InIter>::value
|
||||
&& is_copy_constructible<_Sent>::value
|
||||
&& is_copy_constructible<_OutIter>::value), int> = 0 >
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
pair<_InIter, _OutIter> __copy(_InIter __first, _Sent __last, _OutIter __result) {
|
||||
return std::__copy_impl(std::move(__first), std::move(__last), std::move(__result));
|
||||
}
|
||||
template <class _InIter,
|
||||
class _OutIter,
|
||||
__enable_if_t<__is_cpp17_random_access_iterator<_InIter>::value &&
|
||||
!__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _InIter __last, _OutIter __result) {
|
||||
using _Traits = __segmented_iterator_traits<_OutIter>;
|
||||
using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
|
||||
|
||||
template <class _InIter, class _Sent, class _OutIter,
|
||||
__enable_if_t<is_copy_constructible<_InIter>::value
|
||||
&& is_copy_constructible<_Sent>::value
|
||||
&& is_copy_constructible<_OutIter>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
pair<_InIter, _OutIter> __copy(_InIter __first, _Sent __last, _OutIter __result) {
|
||||
auto __range = std::__unwrap_range(__first, __last);
|
||||
auto __ret = std::__copy_impl(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__result));
|
||||
return std::make_pair(
|
||||
std::__rewrap_range<_Sent>(__first, __ret.first), std::__rewrap_iter(__result, __ret.second));
|
||||
if (__first == __last)
|
||||
return std::make_pair(std::move(__first), std::move(__result));
|
||||
|
||||
auto __local_first = _Traits::__local(__result);
|
||||
auto __segment_iterator = _Traits::__segment(__result);
|
||||
while (true) {
|
||||
auto __local_last = _Traits::__end(__segment_iterator);
|
||||
auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first);
|
||||
auto __iters = std::__copy<_AlgPolicy>(__first, __first + __size, __local_first);
|
||||
__first = std::move(__iters.first);
|
||||
|
||||
if (__first == __last)
|
||||
return std::make_pair(std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.second)));
|
||||
|
||||
__local_first = _Traits::__begin(++__segment_iterator);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct __copy_trivial {
|
||||
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
|
||||
template <class _In, class _Out,
|
||||
__enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
|
||||
operator()(_In* __first, _In* __last, _Out* __result) const {
|
||||
return std::__copy_trivial_impl(__first, __last, __result);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter>
|
||||
pair<_InIter, _OutIter> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
__copy(_InIter __first, _Sent __last, _OutIter __result) {
|
||||
return std::__dispatch_copy_or_move<_AlgPolicy, __copy_loop<_AlgPolicy>, __copy_trivial>(
|
||||
std::move(__first), std::move(__last), std::move(__result));
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
|
||||
copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
|
||||
return std::__copy(__first, __last, __result).second;
|
||||
return std::__copy<_ClassicAlgPolicy>(__first, __last, __result).second;
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_COPY_H
|
||||
|
|
|
|||
142
lib/libcxx/include/__algorithm/copy_backward.h
vendored
142
lib/libcxx/include/__algorithm/copy_backward.h
vendored
|
|
@ -9,53 +9,135 @@
|
|||
#ifndef _LIBCPP___ALGORITHM_COPY_BACKWARD_H
|
||||
#define _LIBCPP___ALGORITHM_COPY_BACKWARD_H
|
||||
|
||||
#include <__algorithm/copy.h>
|
||||
#include <__algorithm/copy_move_common.h>
|
||||
#include <__algorithm/iterator_operations.h>
|
||||
#include <__algorithm/ranges_copy.h>
|
||||
#include <__algorithm/unwrap_iter.h>
|
||||
#include <__concepts/same_as.h>
|
||||
#include <__algorithm/min.h>
|
||||
#include <__config>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__iterator/reverse_iterator.h>
|
||||
#include <__ranges/subrange.h>
|
||||
#include <__iterator/segmented_iterator.h>
|
||||
#include <__type_traits/common_type.h>
|
||||
#include <__type_traits/is_copy_constructible.h>
|
||||
#include <__utility/move.h>
|
||||
#include <__utility/pair.h>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _AlgPolicy, class _InputIterator, class _OutputIterator,
|
||||
__enable_if_t<is_same<_AlgPolicy, _ClassicAlgPolicy>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_InputIterator, _OutputIterator>
|
||||
__copy_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
|
||||
auto __ret = std::__copy(
|
||||
__unconstrained_reverse_iterator<_InputIterator>(__last),
|
||||
__unconstrained_reverse_iterator<_InputIterator>(__first),
|
||||
__unconstrained_reverse_iterator<_OutputIterator>(__result));
|
||||
return pair<_InputIterator, _OutputIterator>(__ret.first.base(), __ret.second.base());
|
||||
}
|
||||
template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InIter, _OutIter>
|
||||
__copy_backward(_InIter __first, _Sent __last, _OutIter __result);
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
template <class _AlgPolicy, class _Iter1, class _Sent1, class _Iter2,
|
||||
__enable_if_t<is_same<_AlgPolicy, _RangeAlgPolicy>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr pair<_Iter1, _Iter2> __copy_backward(_Iter1 __first, _Sent1 __last, _Iter2 __result) {
|
||||
auto __last_iter = _IterOps<_AlgPolicy>::next(__first, std::move(__last));
|
||||
auto __reverse_range = std::__reverse_range(std::ranges::subrange(std::move(__first), __last_iter));
|
||||
auto __ret = ranges::copy(std::move(__reverse_range), std::make_reverse_iterator(__result));
|
||||
return std::make_pair(__last_iter, __ret.out.base());
|
||||
template <class _AlgPolicy>
|
||||
struct __copy_backward_loop {
|
||||
template <class _InIter, class _Sent, class _OutIter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _Sent __last, _OutIter __result) const {
|
||||
auto __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
|
||||
auto __original_last_iter = __last_iter;
|
||||
|
||||
while (__first != __last_iter) {
|
||||
*--__result = *--__last_iter;
|
||||
}
|
||||
|
||||
return std::make_pair(std::move(__original_last_iter), std::move(__result));
|
||||
}
|
||||
|
||||
template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
|
||||
using _Traits = __segmented_iterator_traits<_InIter>;
|
||||
auto __sfirst = _Traits::__segment(__first);
|
||||
auto __slast = _Traits::__segment(__last);
|
||||
if (__sfirst == __slast) {
|
||||
auto __iters =
|
||||
std::__copy_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__local(__last), std::move(__result));
|
||||
return std::make_pair(__last, __iters.second);
|
||||
}
|
||||
|
||||
__result =
|
||||
std::__copy_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__local(__last), std::move(__result))
|
||||
.second;
|
||||
--__slast;
|
||||
while (__sfirst != __slast) {
|
||||
__result =
|
||||
std::__copy_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__end(__slast), std::move(__result))
|
||||
.second;
|
||||
--__slast;
|
||||
}
|
||||
__result = std::__copy_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__end(__slast), std::move(__result))
|
||||
.second;
|
||||
return std::make_pair(__last, std::move(__result));
|
||||
}
|
||||
|
||||
template <class _InIter,
|
||||
class _OutIter,
|
||||
__enable_if_t<__is_cpp17_random_access_iterator<_InIter>::value &&
|
||||
!__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _InIter __last, _OutIter __result) {
|
||||
using _Traits = __segmented_iterator_traits<_OutIter>;
|
||||
auto __orig_last = __last;
|
||||
auto __segment_iterator = _Traits::__segment(__result);
|
||||
|
||||
// When the range contains no elements, __result might not be a valid iterator
|
||||
if (__first == __last)
|
||||
return std::make_pair(__first, __result);
|
||||
|
||||
auto __local_last = _Traits::__local(__result);
|
||||
while (true) {
|
||||
using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
|
||||
|
||||
auto __local_first = _Traits::__begin(__segment_iterator);
|
||||
auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first);
|
||||
auto __iter = std::__copy_backward<_AlgPolicy>(__last - __size, __last, __local_last).second;
|
||||
__last -= __size;
|
||||
|
||||
if (__first == __last)
|
||||
return std::make_pair(std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter)));
|
||||
--__segment_iterator;
|
||||
__local_last = _Traits::__end(__segment_iterator);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct __copy_backward_trivial {
|
||||
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
|
||||
template <class _In, class _Out,
|
||||
__enable_if_t<__can_lower_copy_assignment_to_memmove<_In, _Out>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
|
||||
operator()(_In* __first, _In* __last, _Out* __result) const {
|
||||
return std::__copy_backward_trivial_impl(__first, __last, __result);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2>
|
||||
__copy_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) {
|
||||
return std::__dispatch_copy_or_move<_AlgPolicy, __copy_backward_loop<_AlgPolicy>, __copy_backward_trivial>(
|
||||
std::move(__first), std::move(__last), std::move(__result));
|
||||
}
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
|
||||
template <class _BidirectionalIterator1, class _BidirectionalIterator2>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _BidirectionalIterator2
|
||||
copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) {
|
||||
return std::__copy_backward<_ClassicAlgPolicy>(__first, __last, __result).second;
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_BidirectionalIterator2
|
||||
copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
|
||||
_BidirectionalIterator2 __result)
|
||||
{
|
||||
static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value &&
|
||||
std::is_copy_constructible<_BidirectionalIterator1>::value, "Iterators must be copy constructible.");
|
||||
|
||||
return std::__copy_backward<_ClassicAlgPolicy>(
|
||||
std::move(__first), std::move(__last), std::move(__result)).second;
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_COPY_BACKWARD_H
|
||||
|
|
|
|||
2
lib/libcxx/include/__algorithm/copy_if.h
vendored
2
lib/libcxx/include/__algorithm/copy_if.h
vendored
|
|
@ -18,7 +18,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<class _InputIterator, class _OutputIterator, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_OutputIterator
|
||||
copy_if(_InputIterator __first, _InputIterator __last,
|
||||
_OutputIterator __result, _Predicate __pred)
|
||||
|
|
|
|||
163
lib/libcxx/include/__algorithm/copy_move_common.h
vendored
Normal file
163
lib/libcxx/include/__algorithm/copy_move_common.h
vendored
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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___ALGORITHM_COPY_MOVE_COMMON_H
|
||||
#define _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H
|
||||
|
||||
#include <__algorithm/iterator_operations.h>
|
||||
#include <__algorithm/unwrap_iter.h>
|
||||
#include <__algorithm/unwrap_range.h>
|
||||
#include <__config>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__memory/pointer_traits.h>
|
||||
#include <__type_traits/enable_if.h>
|
||||
#include <__type_traits/is_always_bitcastable.h>
|
||||
#include <__type_traits/is_constant_evaluated.h>
|
||||
#include <__type_traits/is_copy_constructible.h>
|
||||
#include <__type_traits/is_trivially_assignable.h>
|
||||
#include <__type_traits/is_trivially_copyable.h>
|
||||
#include <__type_traits/is_volatile.h>
|
||||
#include <__utility/move.h>
|
||||
#include <__utility/pair.h>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// Type traits.
|
||||
|
||||
template <class _From, class _To>
|
||||
struct __can_lower_copy_assignment_to_memmove {
|
||||
static const bool value =
|
||||
// If the types are always bitcastable, it's valid to do a bitwise copy between them.
|
||||
__is_always_bitcastable<_From, _To>::value &&
|
||||
// Reject conversions that wouldn't be performed by the regular built-in assignment (e.g. between arrays).
|
||||
is_trivially_assignable<_To&, const _From&>::value &&
|
||||
// `memmove` doesn't accept `volatile` pointers, make sure the optimization SFINAEs away in that case.
|
||||
!is_volatile<_From>::value &&
|
||||
!is_volatile<_To>::value;
|
||||
};
|
||||
|
||||
template <class _From, class _To>
|
||||
struct __can_lower_move_assignment_to_memmove {
|
||||
static const bool value =
|
||||
__is_always_bitcastable<_From, _To>::value &&
|
||||
is_trivially_assignable<_To&, _From&&>::value &&
|
||||
!is_volatile<_From>::value &&
|
||||
!is_volatile<_To>::value;
|
||||
};
|
||||
|
||||
// `memmove` algorithms implementation.
|
||||
|
||||
template <class _In, class _Out>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
|
||||
__copy_trivial_impl(_In* __first, _In* __last, _Out* __result) {
|
||||
const size_t __n = static_cast<size_t>(__last - __first);
|
||||
::__builtin_memmove(__result, __first, __n * sizeof(_Out));
|
||||
|
||||
return std::make_pair(__last, __result + __n);
|
||||
}
|
||||
|
||||
template <class _In, class _Out>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
|
||||
__copy_backward_trivial_impl(_In* __first, _In* __last, _Out* __result) {
|
||||
const size_t __n = static_cast<size_t>(__last - __first);
|
||||
__result -= __n;
|
||||
|
||||
::__builtin_memmove(__result, __first, __n * sizeof(_Out));
|
||||
|
||||
return std::make_pair(__last, __result);
|
||||
}
|
||||
|
||||
// Iterator unwrapping and dispatching to the correct overload.
|
||||
|
||||
template <class _F1, class _F2>
|
||||
struct __overload : _F1, _F2 {
|
||||
using _F1::operator();
|
||||
using _F2::operator();
|
||||
};
|
||||
|
||||
template <class _InIter, class _Sent, class _OutIter, class = void>
|
||||
struct __can_rewrap : false_type {};
|
||||
|
||||
template <class _InIter, class _Sent, class _OutIter>
|
||||
struct __can_rewrap<_InIter,
|
||||
_Sent,
|
||||
_OutIter,
|
||||
// Note that sentinels are always copy-constructible.
|
||||
__enable_if_t< is_copy_constructible<_InIter>::value &&
|
||||
is_copy_constructible<_OutIter>::value > > : true_type {};
|
||||
|
||||
template <class _Algorithm,
|
||||
class _InIter,
|
||||
class _Sent,
|
||||
class _OutIter,
|
||||
__enable_if_t<__can_rewrap<_InIter, _Sent, _OutIter>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
|
||||
__unwrap_and_dispatch(_InIter __first, _Sent __last, _OutIter __out_first) {
|
||||
auto __range = std::__unwrap_range(__first, std::move(__last));
|
||||
auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first));
|
||||
return std::make_pair(std::__rewrap_range<_Sent>(std::move(__first), std::move(__result.first)),
|
||||
std::__rewrap_iter(std::move(__out_first), std::move(__result.second)));
|
||||
}
|
||||
|
||||
template <class _Algorithm,
|
||||
class _InIter,
|
||||
class _Sent,
|
||||
class _OutIter,
|
||||
__enable_if_t<!__can_rewrap<_InIter, _Sent, _OutIter>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
|
||||
__unwrap_and_dispatch(_InIter __first, _Sent __last, _OutIter __out_first) {
|
||||
return _Algorithm()(std::move(__first), std::move(__last), std::move(__out_first));
|
||||
}
|
||||
|
||||
template <class _IterOps, class _InValue, class _OutIter, class = void>
|
||||
struct __can_copy_without_conversion : false_type {};
|
||||
|
||||
template <class _IterOps, class _InValue, class _OutIter>
|
||||
struct __can_copy_without_conversion<
|
||||
_IterOps,
|
||||
_InValue,
|
||||
_OutIter,
|
||||
__enable_if_t<is_same<_InValue, typename _IterOps::template __value_type<_OutIter> >::value> > : true_type {};
|
||||
|
||||
template <class _AlgPolicy,
|
||||
class _NaiveAlgorithm,
|
||||
class _OptimizedAlgorithm,
|
||||
class _InIter,
|
||||
class _Sent,
|
||||
class _OutIter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
|
||||
__dispatch_copy_or_move(_InIter __first, _Sent __last, _OutIter __out_first) {
|
||||
#ifdef _LIBCPP_COMPILER_GCC
|
||||
// GCC doesn't support `__builtin_memmove` during constant evaluation.
|
||||
if (__libcpp_is_constant_evaluated()) {
|
||||
return std::__unwrap_and_dispatch<_NaiveAlgorithm>(std::move(__first), std::move(__last), std::move(__out_first));
|
||||
}
|
||||
#else
|
||||
// In Clang, `__builtin_memmove` only supports fully trivially copyable types (just having trivial copy assignment is
|
||||
// insufficient). Also, conversions are not supported.
|
||||
if (__libcpp_is_constant_evaluated()) {
|
||||
using _InValue = typename _IterOps<_AlgPolicy>::template __value_type<_InIter>;
|
||||
if (!is_trivially_copyable<_InValue>::value ||
|
||||
!__can_copy_without_conversion<_IterOps<_AlgPolicy>, _InValue, _OutIter>::value) {
|
||||
return std::__unwrap_and_dispatch<_NaiveAlgorithm>(std::move(__first), std::move(__last), std::move(__out_first));
|
||||
}
|
||||
}
|
||||
#endif // _LIBCPP_COMPILER_GCC
|
||||
|
||||
using _Algorithm = __overload<_NaiveAlgorithm, _OptimizedAlgorithm>;
|
||||
return std::__unwrap_and_dispatch<_Algorithm>(std::move(__first), std::move(__last), std::move(__out_first));
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_COPY_MOVE_COMMON_H
|
||||
5
lib/libcxx/include/__algorithm/copy_n.h
vendored
5
lib/libcxx/include/__algorithm/copy_n.h
vendored
|
|
@ -12,6 +12,7 @@
|
|||
#include <__algorithm/copy.h>
|
||||
#include <__config>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__utility/convert_to_integral.h>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
|
@ -21,7 +22,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<class _InputIterator, class _Size, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename enable_if
|
||||
<
|
||||
__is_cpp17_input_iterator<_InputIterator>::value &&
|
||||
|
|
@ -47,7 +48,7 @@ copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
|
|||
}
|
||||
|
||||
template<class _InputIterator, class _Size, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename enable_if
|
||||
<
|
||||
__is_cpp17_random_access_iterator<_InputIterator>::value,
|
||||
|
|
|
|||
2
lib/libcxx/include/__algorithm/count.h
vendored
2
lib/libcxx/include/__algorithm/count.h
vendored
|
|
@ -20,7 +20,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename iterator_traits<_InputIterator>::difference_type
|
||||
count(_InputIterator __first, _InputIterator __last, const _Tp& __value) {
|
||||
typename iterator_traits<_InputIterator>::difference_type __r(0);
|
||||
|
|
|
|||
2
lib/libcxx/include/__algorithm/count_if.h
vendored
2
lib/libcxx/include/__algorithm/count_if.h
vendored
|
|
@ -20,7 +20,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Predicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename iterator_traits<_InputIterator>::difference_type
|
||||
count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
|
||||
typename iterator_traits<_InputIterator>::difference_type __r(0);
|
||||
|
|
|
|||
29
lib/libcxx/include/__algorithm/equal.h
vendored
29
lib/libcxx/include/__algorithm/equal.h
vendored
|
|
@ -22,7 +22,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) {
|
||||
for (; __first1 != __last1; ++__first1, (void)++__first2)
|
||||
if (!__pred(*__first1, *__first2))
|
||||
|
|
@ -31,16 +31,14 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first
|
|||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) {
|
||||
typedef typename iterator_traits<_InputIterator1>::value_type __v1;
|
||||
typedef typename iterator_traits<_InputIterator2>::value_type __v2;
|
||||
return _VSTD::equal(__first1, __last1, __first2, __equal_to<__v1, __v2>());
|
||||
return std::equal(__first1, __last1, __first2, __equal_to());
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _BinaryPredicate, class _InputIterator1, class _InputIterator2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
__equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
|
||||
_BinaryPredicate __pred, input_iterator_tag, input_iterator_tag) {
|
||||
for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void)++__first2)
|
||||
|
|
@ -50,7 +48,7 @@ __equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fir
|
|||
}
|
||||
|
||||
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
__equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2,
|
||||
_RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag,
|
||||
random_access_iterator_tag) {
|
||||
|
|
@ -61,7 +59,7 @@ __equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _Random
|
|||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
|
||||
_BinaryPredicate __pred) {
|
||||
return _VSTD::__equal<_BinaryPredicate&>(
|
||||
|
|
@ -70,13 +68,16 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first
|
|||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
|
||||
typedef typename iterator_traits<_InputIterator1>::value_type __v1;
|
||||
typedef typename iterator_traits<_InputIterator2>::value_type __v2;
|
||||
return _VSTD::__equal(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>(),
|
||||
typename iterator_traits<_InputIterator1>::iterator_category(),
|
||||
typename iterator_traits<_InputIterator2>::iterator_category());
|
||||
return std::__equal(
|
||||
__first1,
|
||||
__last1,
|
||||
__first2,
|
||||
__last2,
|
||||
__equal_to(),
|
||||
typename iterator_traits<_InputIterator1>::iterator_category(),
|
||||
typename iterator_traits<_InputIterator2>::iterator_category());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
13
lib/libcxx/include/__algorithm/equal_range.h
vendored
13
lib/libcxx/include/__algorithm/equal_range.h
vendored
|
|
@ -34,7 +34,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _AlgPolicy, class _Compare, class _Iter, class _Sent, class _Tp, class _Proj>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_Iter, _Iter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_Iter, _Iter>
|
||||
__equal_range(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp, _Proj&& __proj) {
|
||||
auto __len = _IterOps<_AlgPolicy>::distance(__first, __last);
|
||||
_Iter __end = _IterOps<_AlgPolicy>::next(__first, __last);
|
||||
|
|
@ -58,19 +58,22 @@ __equal_range(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp
|
|||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
|
||||
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
|
||||
static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value,
|
||||
"The comparator has to be callable");
|
||||
static_assert(is_copy_constructible<_ForwardIterator>::value,
|
||||
"Iterator has to be copy constructible");
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return std::__equal_range<_ClassicAlgPolicy>(
|
||||
std::move(__first), std::move(__last), __value, static_cast<_Comp_ref>(__comp), std::__identity());
|
||||
std::move(__first),
|
||||
std::move(__last),
|
||||
__value,
|
||||
static_cast<__comp_ref_type<_Compare> >(__comp),
|
||||
std::__identity());
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
|
||||
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
|
||||
return std::equal_range(
|
||||
std::move(__first),
|
||||
|
|
|
|||
6
lib/libcxx/include/__algorithm/fill.h
vendored
6
lib/libcxx/include/__algorithm/fill.h
vendored
|
|
@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
// fill isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void
|
||||
__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag)
|
||||
{
|
||||
|
|
@ -32,7 +32,7 @@ __fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, fo
|
|||
}
|
||||
|
||||
template <class _RandomAccessIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void
|
||||
__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag)
|
||||
{
|
||||
|
|
@ -40,7 +40,7 @@ __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& _
|
|||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void
|
||||
fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
|
||||
{
|
||||
|
|
|
|||
5
lib/libcxx/include/__algorithm/fill_n.h
vendored
5
lib/libcxx/include/__algorithm/fill_n.h
vendored
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <__config>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__utility/convert_to_integral.h>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
|
@ -22,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
// fill_n isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
|
||||
|
||||
template <class _OutputIterator, class _Size, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_OutputIterator
|
||||
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
|
||||
{
|
||||
|
|
@ -32,7 +33,7 @@ __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
|
|||
}
|
||||
|
||||
template <class _OutputIterator, class _Size, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_OutputIterator
|
||||
fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
|
||||
{
|
||||
|
|
|
|||
2
lib/libcxx/include/__algorithm/find.h
vendored
2
lib/libcxx/include/__algorithm/find.h
vendored
|
|
@ -19,7 +19,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
|
||||
find(_InputIterator __first, _InputIterator __last, const _Tp& __value) {
|
||||
for (; __first != __last; ++__first)
|
||||
if (*__first == __value)
|
||||
|
|
|
|||
16
lib/libcxx/include/__algorithm/find_end.h
vendored
16
lib/libcxx/include/__algorithm/find_end.h
vendored
|
|
@ -37,7 +37,7 @@ template <
|
|||
class _Pred,
|
||||
class _Proj1,
|
||||
class _Proj2>
|
||||
_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_AFTER_CXX11 pair<_Iter1, _Iter1> __find_end_impl(
|
||||
_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_Iter1, _Iter1> __find_end_impl(
|
||||
_Iter1 __first1,
|
||||
_Sent1 __last1,
|
||||
_Iter2 __first2,
|
||||
|
|
@ -91,7 +91,7 @@ template <
|
|||
class _Sent2,
|
||||
class _Proj1,
|
||||
class _Proj2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 _Iter1 __find_end(
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter1 __find_end(
|
||||
_Iter1 __first1,
|
||||
_Sent1 __sent1,
|
||||
_Iter2 __first2,
|
||||
|
|
@ -144,7 +144,7 @@ template <
|
|||
class _Sent2,
|
||||
class _Proj1,
|
||||
class _Proj2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _Iter1 __find_end(
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Iter1 __find_end(
|
||||
_Iter1 __first1,
|
||||
_Sent1 __sent1,
|
||||
_Iter2 __first2,
|
||||
|
|
@ -189,7 +189,7 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 _Iter1 __find_end(
|
|||
}
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
_ForwardIterator1 __find_end_classic(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
|
||||
_BinaryPredicate& __pred) {
|
||||
|
|
@ -208,7 +208,7 @@ _ForwardIterator1 __find_end_classic(_ForwardIterator1 __first1, _ForwardIterato
|
|||
}
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
|
||||
_BinaryPredicate __pred) {
|
||||
|
|
@ -216,12 +216,10 @@ _ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1
|
|||
}
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
_ForwardIterator2 __first2, _ForwardIterator2 __last2) {
|
||||
using __v1 = typename iterator_traits<_ForwardIterator1>::value_type;
|
||||
using __v2 = typename iterator_traits<_ForwardIterator2>::value_type;
|
||||
return std::find_end(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
|
||||
return std::find_end(__first1, __last1, __first2, __last2, __equal_to());
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
|
|
|||
11
lib/libcxx/include/__algorithm/find_first_of.h
vendored
11
lib/libcxx/include/__algorithm/find_first_of.h
vendored
|
|
@ -21,7 +21,8 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator1 __find_first_of_ce(_ForwardIterator1 __first1,
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator1 __find_first_of_ce(_ForwardIterator1 __first1,
|
||||
_ForwardIterator1 __last1,
|
||||
_ForwardIterator2 __first2,
|
||||
_ForwardIterator2 __last2,
|
||||
|
|
@ -34,18 +35,16 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator1 __find_first_of_ce(_ForwardItera
|
|||
}
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1
|
||||
find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
|
||||
_ForwardIterator2 __last2, _BinaryPredicate __pred) {
|
||||
return _VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __pred);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator1 find_first_of(
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator1 find_first_of(
|
||||
_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) {
|
||||
typedef typename iterator_traits<_ForwardIterator1>::value_type __v1;
|
||||
typedef typename iterator_traits<_ForwardIterator2>::value_type __v2;
|
||||
return _VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
|
||||
return std::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to());
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
|
|
|||
2
lib/libcxx/include/__algorithm/find_if.h
vendored
2
lib/libcxx/include/__algorithm/find_if.h
vendored
|
|
@ -19,7 +19,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Predicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
|
||||
find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
|
||||
for (; __first != __last; ++__first)
|
||||
if (__pred(*__first))
|
||||
|
|
|
|||
2
lib/libcxx/include/__algorithm/find_if_not.h
vendored
2
lib/libcxx/include/__algorithm/find_if_not.h
vendored
|
|
@ -19,7 +19,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Predicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator
|
||||
find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
|
||||
for (; __first != __last; ++__first)
|
||||
if (!__pred(*__first))
|
||||
|
|
|
|||
2
lib/libcxx/include/__algorithm/for_each.h
vendored
2
lib/libcxx/include/__algorithm/for_each.h
vendored
|
|
@ -19,7 +19,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Function>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _Function for_each(_InputIterator __first,
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _Function for_each(_InputIterator __first,
|
||||
_InputIterator __last,
|
||||
_Function __f) {
|
||||
for (; __first != __last; ++__first)
|
||||
|
|
|
|||
3
lib/libcxx/include/__algorithm/for_each_n.h
vendored
3
lib/libcxx/include/__algorithm/for_each_n.h
vendored
|
|
@ -11,6 +11,7 @@
|
|||
#define _LIBCPP___ALGORITHM_FOR_EACH_N_H
|
||||
|
||||
#include <__config>
|
||||
#include <__utility/convert_to_integral.h>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
|
@ -22,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
#if _LIBCPP_STD_VER > 14
|
||||
|
||||
template <class _InputIterator, class _Size, class _Function>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 _InputIterator for_each_n(_InputIterator __first,
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator for_each_n(_InputIterator __first,
|
||||
_Size __orig_n,
|
||||
_Function __f) {
|
||||
typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
|
||||
|
|
|
|||
2
lib/libcxx/include/__algorithm/generate.h
vendored
2
lib/libcxx/include/__algorithm/generate.h
vendored
|
|
@ -18,7 +18,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _ForwardIterator, class _Generator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void
|
||||
generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen)
|
||||
{
|
||||
|
|
|
|||
3
lib/libcxx/include/__algorithm/generate_n.h
vendored
3
lib/libcxx/include/__algorithm/generate_n.h
vendored
|
|
@ -10,6 +10,7 @@
|
|||
#define _LIBCPP___ALGORITHM_GENERATE_N_H
|
||||
|
||||
#include <__config>
|
||||
#include <__utility/convert_to_integral.h>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
|
@ -19,7 +20,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _OutputIterator, class _Size, class _Generator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_OutputIterator
|
||||
generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ typename enable_if
|
|||
>::type
|
||||
__half_positive(_Integral __value)
|
||||
{
|
||||
return static_cast<_Integral>(static_cast<typename make_unsigned<_Integral>::type>(__value) / 2);
|
||||
return static_cast<_Integral>(static_cast<__make_unsigned_t<_Integral> >(__value) / 2);
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -44,6 +44,6 @@ struct in_found_result {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_IN_FOUND_RESULT_H
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
namespace ranges {
|
||||
template <class _InIter1, class _Func1>
|
||||
|
|
@ -42,7 +42,7 @@ struct in_fun_result {
|
|||
};
|
||||
} // namespace ranges
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
namespace ranges {
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ struct in_in_out_result {
|
|||
|
||||
} // namespace ranges
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
namespace ranges {
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ struct in_in_result {
|
|||
|
||||
} // namespace ranges
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
namespace ranges {
|
||||
template <class _InIter1, class _OutIter1, class _OutIter2>
|
||||
|
|
@ -47,7 +47,7 @@ struct in_out_out_result {
|
|||
};
|
||||
} // namespace ranges
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
namespace ranges {
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ struct in_out_result {
|
|||
|
||||
} // namespace ranges
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
|
|||
16
lib/libcxx/include/__algorithm/includes.h
vendored
16
lib/libcxx/include/__algorithm/includes.h
vendored
|
|
@ -25,7 +25,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Comp, class _Proj1, class _Proj2>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
__includes(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
|
||||
_Comp&& __comp, _Proj1&& __proj1, _Proj2&& __proj2) {
|
||||
for (; __first2 != __last2; ++__first1) {
|
||||
|
|
@ -39,7 +39,7 @@ __includes(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
|
|||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool includes(
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool includes(
|
||||
_InputIterator1 __first1,
|
||||
_InputIterator1 __last1,
|
||||
_InputIterator2 __first2,
|
||||
|
|
@ -48,14 +48,18 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
|||
static_assert(__is_callable<_Compare, decltype(*__first1), decltype(*__first2)>::value,
|
||||
"Comparator has to be callable");
|
||||
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return std::__includes(
|
||||
std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
|
||||
static_cast<_Comp_ref>(__comp), __identity(), __identity());
|
||||
std::move(__first1),
|
||||
std::move(__last1),
|
||||
std::move(__first2),
|
||||
std::move(__last2),
|
||||
static_cast<__comp_ref_type<_Compare> >(__comp),
|
||||
__identity(),
|
||||
__identity());
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
|
||||
return std::includes(
|
||||
std::move(__first1),
|
||||
|
|
|
|||
11
lib/libcxx/include/__algorithm/inplace_merge.h
vendored
11
lib/libcxx/include/__algorithm/inplace_merge.h
vendored
|
|
@ -23,7 +23,11 @@
|
|||
#include <__iterator/distance.h>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__iterator/reverse_iterator.h>
|
||||
#include <memory>
|
||||
#include <__memory/destruct_n.h>
|
||||
#include <__memory/temporary_buffer.h>
|
||||
#include <__memory/unique_ptr.h>
|
||||
#include <__utility/pair.h>
|
||||
#include <new>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
|
|
@ -56,6 +60,7 @@ public:
|
|||
|
||||
template <class _AlgPolicy, class _Compare, class _InputIterator1, class _Sent1,
|
||||
class _InputIterator2, class _Sent2, class _OutputIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
void __half_inplace_merge(_InputIterator1 __first1, _Sent1 __last1,
|
||||
_InputIterator2 __first2, _Sent2 __last2,
|
||||
_OutputIterator __result, _Compare&& __comp)
|
||||
|
|
@ -83,6 +88,7 @@ void __half_inplace_merge(_InputIterator1 __first1, _Sent1 __last1,
|
|||
}
|
||||
|
||||
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
void __buffered_inplace_merge(
|
||||
_BidirectionalIterator __first,
|
||||
_BidirectionalIterator __middle,
|
||||
|
|
@ -231,9 +237,8 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
|
|||
template <class _BidirectionalIterator, class _Compare>
|
||||
inline _LIBCPP_HIDE_FROM_ABI void inplace_merge(
|
||||
_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Compare __comp) {
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
std::__inplace_merge<_ClassicAlgPolicy>(
|
||||
std::move(__first), std::move(__middle), std::move(__last), static_cast<_Comp_ref>(__comp));
|
||||
std::move(__first), std::move(__middle), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp));
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator>
|
||||
|
|
|
|||
7
lib/libcxx/include/__algorithm/is_heap.h
vendored
7
lib/libcxx/include/__algorithm/is_heap.h
vendored
|
|
@ -23,17 +23,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
template <class _RandomAccessIterator, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
|
||||
{
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return std::__is_heap_until(__first, __last, static_cast<_Comp_ref>(__comp)) == __last;
|
||||
return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp)) == __last;
|
||||
}
|
||||
|
||||
template<class _RandomAccessIterator>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Compare, class _RandomAccessIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
|
||||
__is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp)
|
||||
{
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
|
||||
|
|
@ -48,15 +48,14 @@ __is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
|
|||
}
|
||||
|
||||
template <class _RandomAccessIterator, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
|
||||
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
|
||||
{
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return std::__is_heap_until(__first, __last, static_cast<_Comp_ref>(__comp));
|
||||
return std::__is_heap_until(__first, __last, static_cast<__comp_ref_type<_Compare> >(__comp));
|
||||
}
|
||||
|
||||
template<class _RandomAccessIterator>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _RandomAccessIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _RandomAccessIterator
|
||||
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
|
||||
{
|
||||
return _VSTD::__is_heap_until(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>());
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Predicate>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
|
|
|
|||
37
lib/libcxx/include/__algorithm/is_permutation.h
vendored
37
lib/libcxx/include/__algorithm/is_permutation.h
vendored
|
|
@ -55,7 +55,7 @@ struct _ConstTimeDistance<_Iter1, _Iter1, _Iter2, _Iter2, __enable_if_t<
|
|||
template <class _AlgPolicy,
|
||||
class _Iter1, class _Sent1, class _Iter2, class _Sent2,
|
||||
class _Proj1, class _Proj2, class _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
__is_permutation_impl(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
|
||||
_Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2) {
|
||||
using _D1 = __iter_diff_t<_Iter1>;
|
||||
|
|
@ -94,7 +94,7 @@ __is_permutation_impl(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 _
|
|||
|
||||
// 2+1 iterators, predicate. Not used by range algorithms.
|
||||
template <class _AlgPolicy, class _ForwardIterator1, class _Sentinel1, class _ForwardIterator2, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
__is_permutation(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterator2 __first2,
|
||||
_BinaryPredicate&& __pred) {
|
||||
// Shorten sequences as much as possible by lopping of any equal prefix.
|
||||
|
|
@ -122,7 +122,7 @@ __is_permutation(_ForwardIterator1 __first1, _Sentinel1 __last1, _ForwardIterato
|
|||
template <class _AlgPolicy,
|
||||
class _Iter1, class _Sent1, class _Iter2, class _Sent2,
|
||||
class _Proj1, class _Proj2, class _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
__is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
|
||||
_Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2,
|
||||
/*_ConstTimeDistance=*/false_type) {
|
||||
|
|
@ -156,7 +156,7 @@ __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last
|
|||
template <class _AlgPolicy,
|
||||
class _Iter1, class _Sent1, class _Iter2, class _Sent2,
|
||||
class _Proj1, class _Proj2, class _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
__is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
|
||||
_Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2,
|
||||
/*_ConstTimeDistance=*/true_type) {
|
||||
|
|
@ -172,7 +172,7 @@ __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last
|
|||
template <class _AlgPolicy,
|
||||
class _Iter1, class _Sent1, class _Iter2, class _Sent2,
|
||||
class _Proj1, class _Proj2, class _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
__is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
|
||||
_Pred&& __pred, _Proj1&& __proj1, _Proj2&& __proj2) {
|
||||
return std::__is_permutation<_AlgPolicy>(
|
||||
|
|
@ -185,7 +185,7 @@ __is_permutation(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last
|
|||
|
||||
// 2+1 iterators, predicate
|
||||
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
|
||||
_BinaryPredicate __pred) {
|
||||
static_assert(__is_callable<_BinaryPredicate, decltype(*__first1), decltype(*__first2)>::value,
|
||||
|
|
@ -197,31 +197,30 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIt
|
|||
|
||||
// 2+1 iterators
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) {
|
||||
using __v1 = __iter_value_type<_ForwardIterator1>;
|
||||
using __v2 = __iter_value_type<_ForwardIterator2>;
|
||||
return std::is_permutation(__first1, __last1, __first2, __equal_to<__v1, __v2>());
|
||||
return std::is_permutation(__first1, __last1, __first2, __equal_to());
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
// 2+2 iterators
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
|
||||
_ForwardIterator2 __last2) {
|
||||
using __v1 = __iter_value_type<_ForwardIterator1>;
|
||||
using __v2 = __iter_value_type<_ForwardIterator2>;
|
||||
|
||||
_LIBCPP_NODISCARD_EXT 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<__v1, __v2>(), __identity(), __identity());
|
||||
std::move(__first1),
|
||||
std::move(__last1),
|
||||
std::move(__first2),
|
||||
std::move(__last2),
|
||||
__equal_to(),
|
||||
__identity(),
|
||||
__identity());
|
||||
}
|
||||
|
||||
// 2+2 iterators, predicate
|
||||
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT 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,
|
||||
|
|
|
|||
7
lib/libcxx/include/__algorithm/is_sorted.h
vendored
7
lib/libcxx/include/__algorithm/is_sorted.h
vendored
|
|
@ -23,17 +23,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return _VSTD::__is_sorted_until<_Comp_ref>(__first, __last, __comp) == __last;
|
||||
return _VSTD::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp) == __last;
|
||||
}
|
||||
|
||||
template<class _ForwardIterator>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
is_sorted(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Compare, class _ForwardIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
|
||||
__is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
if (__first != __last)
|
||||
|
|
@ -38,15 +38,14 @@ __is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __
|
|||
}
|
||||
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
|
||||
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return _VSTD::__is_sorted_until<_Comp_ref>(__first, __last, __comp);
|
||||
return _VSTD::__is_sorted_until<__comp_ref_type<_Compare> >(__first, __last, __comp);
|
||||
}
|
||||
|
||||
template<class _ForwardIterator>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
|
||||
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
return _VSTD::is_sorted_until(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>());
|
||||
|
|
|
|||
4
lib/libcxx/include/__algorithm/iter_swap.h
vendored
4
lib/libcxx/include/__algorithm/iter_swap.h
vendored
|
|
@ -20,10 +20,10 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 void iter_swap(_ForwardIterator1 __a,
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void iter_swap(_ForwardIterator1 __a,
|
||||
_ForwardIterator2 __b)
|
||||
// _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
|
||||
_NOEXCEPT_(_NOEXCEPT_(swap(*declval<_ForwardIterator1>(), *declval<_ForwardIterator2>()))) {
|
||||
_NOEXCEPT_(_NOEXCEPT_(swap(*std::declval<_ForwardIterator1>(), *std::declval<_ForwardIterator2>()))) {
|
||||
swap(*__a, *__b);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,10 +21,13 @@
|
|||
#include <__iterator/next.h>
|
||||
#include <__iterator/prev.h>
|
||||
#include <__iterator/readable_traits.h>
|
||||
#include <__type_traits/enable_if.h>
|
||||
#include <__type_traits/is_reference.h>
|
||||
#include <__type_traits/is_same.h>
|
||||
#include <__type_traits/remove_cvref.h>
|
||||
#include <__utility/declval.h>
|
||||
#include <__utility/forward.h>
|
||||
#include <__utility/move.h>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
|
|
@ -34,7 +37,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
template <class _AlgPolicy> struct _IterOps;
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
struct _RangeAlgPolicy {};
|
||||
|
||||
template <>
|
||||
|
|
@ -76,14 +79,14 @@ struct _IterOps<_ClassicAlgPolicy> {
|
|||
|
||||
// advance
|
||||
template <class _Iter, class _Distance>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
static void advance(_Iter& __iter, _Distance __count) {
|
||||
std::advance(__iter, __count);
|
||||
}
|
||||
|
||||
// distance
|
||||
template <class _Iter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
static typename iterator_traits<_Iter>::difference_type distance(_Iter __first, _Iter __last) {
|
||||
return std::distance(__first, __last);
|
||||
}
|
||||
|
|
@ -95,9 +98,9 @@ struct _IterOps<_ClassicAlgPolicy> {
|
|||
using __move_t = decltype(std::move(*std::declval<_Iter&>()));
|
||||
|
||||
template <class _Iter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
static void __validate_iter_reference() {
|
||||
static_assert(is_same<__deref_t<_Iter>, typename iterator_traits<__uncvref_t<_Iter> >::reference>::value,
|
||||
static_assert(is_same<__deref_t<_Iter>, typename iterator_traits<__remove_cvref_t<_Iter> >::reference>::value,
|
||||
"It looks like your iterator's `iterator_traits<It>::reference` does not match the return type of "
|
||||
"dereferencing the iterator, i.e., calling `*it`. This is undefined behavior according to [input.iterators] "
|
||||
"and can lead to dangling reference issues at runtime, so we are flagging this.");
|
||||
|
|
@ -105,7 +108,7 @@ struct _IterOps<_ClassicAlgPolicy> {
|
|||
|
||||
// iter_move
|
||||
template <class _Iter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 static
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static
|
||||
// If the result of dereferencing `_Iter` is a reference type, deduce the result of calling `std::move` on it. Note
|
||||
// that the C++03 mode doesn't support `decltype(auto)` as the return type.
|
||||
__enable_if_t<
|
||||
|
|
@ -118,7 +121,7 @@ struct _IterOps<_ClassicAlgPolicy> {
|
|||
}
|
||||
|
||||
template <class _Iter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 static
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static
|
||||
// If the result of dereferencing `_Iter` is a value type, deduce the return value of this function to also be a
|
||||
// value -- otherwise, after `operator*` returns a temporary, this function would return a dangling reference to that
|
||||
// temporary. Note that the C++03 mode doesn't support `auto` as the return type.
|
||||
|
|
@ -133,35 +136,35 @@ struct _IterOps<_ClassicAlgPolicy> {
|
|||
|
||||
// iter_swap
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
static void iter_swap(_Iter1&& __a, _Iter2&& __b) {
|
||||
std::iter_swap(std::forward<_Iter1>(__a), std::forward<_Iter2>(__b));
|
||||
}
|
||||
|
||||
// next
|
||||
template <class _Iterator>
|
||||
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
_Iterator next(_Iterator, _Iterator __last) {
|
||||
return __last;
|
||||
}
|
||||
|
||||
template <class _Iter>
|
||||
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
__uncvref_t<_Iter> next(_Iter&& __it,
|
||||
typename iterator_traits<__uncvref_t<_Iter> >::difference_type __n = 1) {
|
||||
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
__remove_cvref_t<_Iter> next(_Iter&& __it,
|
||||
typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) {
|
||||
return std::next(std::forward<_Iter>(__it), __n);
|
||||
}
|
||||
|
||||
// prev
|
||||
template <class _Iter>
|
||||
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
__uncvref_t<_Iter> prev(_Iter&& __iter,
|
||||
typename iterator_traits<__uncvref_t<_Iter> >::difference_type __n = 1) {
|
||||
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
__remove_cvref_t<_Iter> prev(_Iter&& __iter,
|
||||
typename iterator_traits<__remove_cvref_t<_Iter> >::difference_type __n = 1) {
|
||||
return std::prev(std::forward<_Iter>(__iter), __n);
|
||||
}
|
||||
|
||||
template <class _Iter>
|
||||
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
void __advance_to(_Iter& __first, _Iter __last) {
|
||||
__first = __last;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Compare, class _InputIterator1, class _InputIterator2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
__lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
|
||||
{
|
||||
|
|
@ -37,18 +37,17 @@ __lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
|
|||
|
||||
template <class _InputIterator1, class _InputIterator2, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
|
||||
{
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return _VSTD::__lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
|
||||
return _VSTD::__lexicographical_compare<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __comp);
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2)
|
||||
|
|
|
|||
6
lib/libcxx/include/__algorithm/lower_bound.h
vendored
6
lib/libcxx/include/__algorithm/lower_bound.h
vendored
|
|
@ -29,7 +29,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _AlgPolicy, class _Iter, class _Sent, class _Type, class _Proj, class _Comp>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_Iter __lower_bound_impl(_Iter __first, _Sent __last, const _Type& __value, _Comp& __comp, _Proj& __proj) {
|
||||
auto __len = _IterOps<_AlgPolicy>::distance(__first, __last);
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ _Iter __lower_bound_impl(_Iter __first, _Sent __last, const _Type& __value, _Com
|
|||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
|
||||
static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value,
|
||||
"The comparator has to be callable");
|
||||
|
|
@ -57,7 +57,7 @@ _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last,
|
|||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
|
||||
return std::lower_bound(__first, __last, __value,
|
||||
__less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
|
||||
|
|
|
|||
9
lib/libcxx/include/__algorithm/make_heap.h
vendored
9
lib/libcxx/include/__algorithm/make_heap.h
vendored
|
|
@ -24,10 +24,9 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
void __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
|
||||
using _CompRef = typename __comp_ref_type<_Compare>::type;
|
||||
_CompRef __comp_ref = __comp;
|
||||
__comp_ref_type<_Compare> __comp_ref = __comp;
|
||||
|
||||
using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
|
||||
difference_type __n = __last - __first;
|
||||
|
|
@ -40,13 +39,13 @@ void __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _C
|
|||
}
|
||||
|
||||
template <class _RandomAccessIterator, class _Compare>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
|
||||
std::__make_heap<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
|
||||
std::make_heap(std::move(__first), std::move(__last),
|
||||
__less<typename iterator_traits<_RandomAccessIterator>::value_type>());
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ __make_projected(_Pred& __pred, _Proj&) {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -121,6 +121,6 @@ decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __p
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_MAKE_PROJECTED_H
|
||||
|
|
|
|||
11
lib/libcxx/include/__algorithm/max.h
vendored
11
lib/libcxx/include/__algorithm/max.h
vendored
|
|
@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
template <class _Tp, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
const _Tp&
|
||||
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
|
||||
{
|
||||
|
|
@ -35,7 +35,7 @@ max(const _Tp& __a, const _Tp& __b, _Compare __comp)
|
|||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
const _Tp&
|
||||
max(const _Tp& __a, const _Tp& __b)
|
||||
{
|
||||
|
|
@ -46,17 +46,16 @@ max(const _Tp& __a, const _Tp& __b)
|
|||
|
||||
template<class _Tp, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
_Tp
|
||||
max(initializer_list<_Tp> __t, _Compare __comp)
|
||||
{
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return *_VSTD::__max_element<_Comp_ref>(__t.begin(), __t.end(), __comp);
|
||||
return *_VSTD::__max_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
_Tp
|
||||
max(initializer_list<_Tp> __t)
|
||||
{
|
||||
|
|
|
|||
9
lib/libcxx/include/__algorithm/max_element.h
vendored
9
lib/libcxx/include/__algorithm/max_element.h
vendored
|
|
@ -21,7 +21,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Compare, class _ForwardIterator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
|
||||
__max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
|
||||
|
|
@ -37,16 +37,15 @@ __max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp
|
|||
}
|
||||
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
|
||||
max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return _VSTD::__max_element<_Comp_ref>(__first, __last, __comp);
|
||||
return _VSTD::__max_element<__comp_ref_type<_Compare> >(__first, __last, __comp);
|
||||
}
|
||||
|
||||
|
||||
template <class _ForwardIterator>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
|
||||
max_element(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
return _VSTD::max_element(__first, __last,
|
||||
|
|
|
|||
9
lib/libcxx/include/__algorithm/merge.h
vendored
9
lib/libcxx/include/__algorithm/merge.h
vendored
|
|
@ -22,7 +22,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_OutputIterator
|
||||
__merge(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
|
||||
|
|
@ -46,17 +46,16 @@ __merge(_InputIterator1 __first1, _InputIterator1 __last1,
|
|||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_OutputIterator
|
||||
merge(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
|
||||
{
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
|
||||
return _VSTD::__merge<__comp_ref_type<_Compare> >(__first1, __last1, __first2, __last2, __result, __comp);
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_OutputIterator
|
||||
merge(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result)
|
||||
|
|
|
|||
11
lib/libcxx/include/__algorithm/min.h
vendored
11
lib/libcxx/include/__algorithm/min.h
vendored
|
|
@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
template <class _Tp, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
const _Tp&
|
||||
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
|
||||
{
|
||||
|
|
@ -35,7 +35,7 @@ min(const _Tp& __a, const _Tp& __b, _Compare __comp)
|
|||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
const _Tp&
|
||||
min(const _Tp& __a, const _Tp& __b)
|
||||
{
|
||||
|
|
@ -46,17 +46,16 @@ min(const _Tp& __a, const _Tp& __b)
|
|||
|
||||
template<class _Tp, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
_Tp
|
||||
min(initializer_list<_Tp> __t, _Compare __comp)
|
||||
{
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return *_VSTD::__min_element<_Comp_ref>(__t.begin(), __t.end(), __comp);
|
||||
return *_VSTD::__min_element<__comp_ref_type<_Compare> >(__t.begin(), __t.end(), __comp);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
_Tp
|
||||
min(initializer_list<_Tp> __t)
|
||||
{
|
||||
|
|
|
|||
11
lib/libcxx/include/__algorithm/min_element.h
vendored
11
lib/libcxx/include/__algorithm/min_element.h
vendored
|
|
@ -25,7 +25,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Comp, class _Iter, class _Sent, class _Proj>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
_Iter __min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) {
|
||||
if (__first == __last)
|
||||
return __first;
|
||||
|
|
@ -39,14 +39,14 @@ _Iter __min_element(_Iter __first, _Sent __last, _Comp __comp, _Proj& __proj) {
|
|||
}
|
||||
|
||||
template <class _Comp, class _Iter, class _Sent>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
_Iter __min_element(_Iter __first, _Sent __last, _Comp __comp) {
|
||||
auto __proj = __identity();
|
||||
return std::__min_element<_Comp>(std::move(__first), std::move(__last), __comp, __proj);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
|
||||
min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
|
||||
|
|
@ -54,12 +54,11 @@ min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
|||
static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__first)>::value,
|
||||
"The comparator has to be callable");
|
||||
|
||||
typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
|
||||
return std::__min_element<_Comp_ref>(std::move(__first), std::move(__last), __comp);
|
||||
return std::__min_element<__comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _ForwardIterator
|
||||
min_element(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
return _VSTD::min_element(__first, __last,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ _LIBCPP_PUSH_MACROS
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
namespace ranges {
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ struct min_max_result {
|
|||
|
||||
} // namespace ranges
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
|
|||
8
lib/libcxx/include/__algorithm/minmax.h
vendored
8
lib/libcxx/include/__algorithm/minmax.h
vendored
|
|
@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
template<class _Tp, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
pair<const _Tp&, const _Tp&>
|
||||
minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
|
||||
{
|
||||
|
|
@ -35,7 +35,7 @@ minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
|
|||
|
||||
template<class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
pair<const _Tp&, const _Tp&>
|
||||
minmax(const _Tp& __a, const _Tp& __b)
|
||||
{
|
||||
|
|
@ -45,7 +45,7 @@ minmax(const _Tp& __a, const _Tp& __b)
|
|||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template<class _Tp, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_NODISCARD_EXT 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;
|
||||
|
|
@ -55,7 +55,7 @@ pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t, _Compare __comp) {
|
|||
|
||||
template<class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
pair<_Tp, _Tp>
|
||||
minmax(initializer_list<_Tp> __t)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,14 +32,14 @@ public:
|
|||
_MinmaxElementLessFunc(_Comp& __comp, _Proj& __proj) : __comp_(__comp), __proj_(__proj) {}
|
||||
|
||||
template <class _Iter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
bool operator()(_Iter& __it1, _Iter& __it2) {
|
||||
return std::__invoke(__comp_, std::__invoke(__proj_, *__it1), std::__invoke(__proj_, *__it2));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Iter, class _Sent, class _Proj, class _Comp>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
pair<_Iter, _Iter> __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
|
||||
auto __less = _MinmaxElementLessFunc<_Comp, _Proj>(__comp, __proj);
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ pair<_Iter, _Iter> __minmax_element_impl(_Iter __first, _Sent __last, _Comp& __c
|
|||
}
|
||||
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
pair<_ForwardIterator, _ForwardIterator>
|
||||
minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) {
|
||||
static_assert(__is_cpp17_forward_iterator<_ForwardIterator>::value,
|
||||
|
|
@ -91,7 +91,7 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com
|
|||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last) {
|
||||
return std::minmax_element(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>());
|
||||
}
|
||||
|
|
|
|||
16
lib/libcxx/include/__algorithm/mismatch.h
vendored
16
lib/libcxx/include/__algorithm/mismatch.h
vendored
|
|
@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
|
||||
mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) {
|
||||
for (; __first1 != __last1; ++__first1, (void)++__first2)
|
||||
if (!__pred(*__first1, *__first2))
|
||||
|
|
@ -33,17 +33,15 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY
|
|||
|
||||
template <class _InputIterator1, class _InputIterator2>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
|
||||
mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) {
|
||||
typedef typename iterator_traits<_InputIterator1>::value_type __v1;
|
||||
typedef typename iterator_traits<_InputIterator2>::value_type __v2;
|
||||
return _VSTD::mismatch(__first1, __last1, __first2, __equal_to<__v1, __v2>());
|
||||
return std::mismatch(__first1, __last1, __first2, __equal_to());
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
|
||||
mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
|
||||
_BinaryPredicate __pred) {
|
||||
for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void)++__first2)
|
||||
|
|
@ -54,11 +52,9 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY
|
|||
|
||||
template <class _InputIterator1, class _InputIterator2>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator1, _InputIterator2>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
|
||||
mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) {
|
||||
typedef typename iterator_traits<_InputIterator1>::value_type __v1;
|
||||
typedef typename iterator_traits<_InputIterator2>::value_type __v2;
|
||||
return _VSTD::mismatch(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
|
||||
return std::mismatch(__first1, __last1, __first2, __last2, __equal_to());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
169
lib/libcxx/include/__algorithm/move.h
vendored
169
lib/libcxx/include/__algorithm/move.h
vendored
|
|
@ -9,111 +9,122 @@
|
|||
#ifndef _LIBCPP___ALGORITHM_MOVE_H
|
||||
#define _LIBCPP___ALGORITHM_MOVE_H
|
||||
|
||||
#include <__algorithm/copy_move_common.h>
|
||||
#include <__algorithm/iterator_operations.h>
|
||||
#include <__algorithm/unwrap_iter.h>
|
||||
#include <__algorithm/min.h>
|
||||
#include <__config>
|
||||
#include <__iterator/iterator_traits.h>
|
||||
#include <__iterator/reverse_iterator.h>
|
||||
#include <__iterator/segmented_iterator.h>
|
||||
#include <__type_traits/common_type.h>
|
||||
#include <__type_traits/is_copy_constructible.h>
|
||||
#include <__utility/move.h>
|
||||
#include <__utility/pair.h>
|
||||
#include <cstring>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// move
|
||||
|
||||
template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
pair<_InIter, _OutIter> __move_impl(_InIter __first, _Sent __last, _OutIter __result) {
|
||||
while (__first != __last) {
|
||||
*__result = _IterOps<_AlgPolicy>::__iter_move(__first);
|
||||
++__first;
|
||||
++__result;
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
__move(_InIter __first, _Sent __last, _OutIter __result);
|
||||
|
||||
template <class _AlgPolicy>
|
||||
struct __move_loop {
|
||||
template <class _InIter, class _Sent, class _OutIter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _Sent __last, _OutIter __result) const {
|
||||
while (__first != __last) {
|
||||
*__result = _IterOps<_AlgPolicy>::__iter_move(__first);
|
||||
++__first;
|
||||
++__result;
|
||||
}
|
||||
return std::make_pair(std::move(__first), std::move(__result));
|
||||
}
|
||||
return std::make_pair(std::move(__first), std::move(__result));
|
||||
}
|
||||
|
||||
template <class _AlgPolicy,
|
||||
class _InType,
|
||||
class _OutType,
|
||||
class = __enable_if_t<is_same<typename remove_const<_InType>::type, _OutType>::value
|
||||
&& is_trivially_move_assignable<_OutType>::value> >
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
pair<_InType*, _OutType*> __move_impl(_InType* __first, _InType* __last, _OutType* __result) {
|
||||
if (__libcpp_is_constant_evaluated()
|
||||
// TODO: Remove this once GCC supports __builtin_memmove during constant evaluation
|
||||
#ifndef _LIBCPP_COMPILER_GCC
|
||||
&& !is_trivially_copyable<_InType>::value
|
||||
#endif
|
||||
)
|
||||
return std::__move_impl<_AlgPolicy, _InType*, _InType*, _OutType*>(__first, __last, __result);
|
||||
const size_t __n = static_cast<size_t>(__last - __first);
|
||||
::__builtin_memmove(__result, __first, __n * sizeof(_OutType));
|
||||
return std::make_pair(__first + __n, __result + __n);
|
||||
}
|
||||
template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
|
||||
using _Traits = __segmented_iterator_traits<_InIter>;
|
||||
auto __sfirst = _Traits::__segment(__first);
|
||||
auto __slast = _Traits::__segment(__last);
|
||||
if (__sfirst == __slast) {
|
||||
auto __iters = std::__move<_AlgPolicy>(_Traits::__local(__first), _Traits::__local(__last), std::move(__result));
|
||||
return std::make_pair(__last, std::move(__iters.second));
|
||||
}
|
||||
|
||||
template <class>
|
||||
struct __is_trivially_move_assignable_unwrapped_impl : false_type {};
|
||||
__result = std::__move<_AlgPolicy>(_Traits::__local(__first), _Traits::__end(__sfirst), std::move(__result)).second;
|
||||
++__sfirst;
|
||||
while (__sfirst != __slast) {
|
||||
__result =
|
||||
std::__move<_AlgPolicy>(_Traits::__begin(__sfirst), _Traits::__end(__sfirst), std::move(__result)).second;
|
||||
++__sfirst;
|
||||
}
|
||||
__result =
|
||||
std::__move<_AlgPolicy>(_Traits::__begin(__sfirst), _Traits::__local(__last), std::move(__result)).second;
|
||||
return std::make_pair(__last, std::move(__result));
|
||||
}
|
||||
|
||||
template <class _Type>
|
||||
struct __is_trivially_move_assignable_unwrapped_impl<_Type*> : is_trivially_move_assignable<_Type> {};
|
||||
template <class _InIter,
|
||||
class _OutIter,
|
||||
__enable_if_t<__is_cpp17_random_access_iterator<_InIter>::value &&
|
||||
!__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _InIter __last, _OutIter __result) {
|
||||
using _Traits = __segmented_iterator_traits<_OutIter>;
|
||||
using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
|
||||
|
||||
template <class _Iter>
|
||||
struct __is_trivially_move_assignable_unwrapped
|
||||
: __is_trivially_move_assignable_unwrapped_impl<decltype(std::__unwrap_iter<_Iter>(std::declval<_Iter>()))> {};
|
||||
if (__first == __last)
|
||||
return std::make_pair(std::move(__first), std::move(__result));
|
||||
|
||||
template <class _AlgPolicy,
|
||||
class _InIter,
|
||||
class _OutIter,
|
||||
__enable_if_t<is_same<typename remove_const<typename iterator_traits<_InIter>::value_type>::type,
|
||||
typename iterator_traits<_OutIter>::value_type>::value
|
||||
&& __is_cpp17_contiguous_iterator<_InIter>::value
|
||||
&& __is_cpp17_contiguous_iterator<_OutIter>::value
|
||||
&& is_trivially_move_assignable<__iter_value_type<_OutIter> >::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
pair<reverse_iterator<_InIter>, reverse_iterator<_OutIter> >
|
||||
__move_impl(reverse_iterator<_InIter> __first,
|
||||
reverse_iterator<_InIter> __last,
|
||||
reverse_iterator<_OutIter> __result) {
|
||||
auto __first_base = std::__unwrap_iter(__first.base());
|
||||
auto __last_base = std::__unwrap_iter(__last.base());
|
||||
auto __result_base = std::__unwrap_iter(__result.base());
|
||||
auto __result_first = __result_base - (__first_base - __last_base);
|
||||
std::__move_impl<_AlgPolicy>(__last_base, __first_base, __result_first);
|
||||
return std::make_pair(__last, reverse_iterator<_OutIter>(std::__rewrap_iter(__result.base(), __result_first)));
|
||||
}
|
||||
auto __local_first = _Traits::__local(__result);
|
||||
auto __segment_iterator = _Traits::__segment(__result);
|
||||
while (true) {
|
||||
auto __local_last = _Traits::__end(__segment_iterator);
|
||||
auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first);
|
||||
auto __iters = std::__move<_AlgPolicy>(__first, __first + __size, __local_first);
|
||||
__first = std::move(__iters.first);
|
||||
|
||||
if (__first == __last)
|
||||
return std::make_pair(std::move(__first), _Traits::__compose(__segment_iterator, std::move(__iters.second)));
|
||||
|
||||
__local_first = _Traits::__begin(++__segment_iterator);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct __move_trivial {
|
||||
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
|
||||
template <class _In, class _Out,
|
||||
__enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
|
||||
operator()(_In* __first, _In* __last, _Out* __result) const {
|
||||
return std::__copy_trivial_impl(__first, __last, __result);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
__enable_if_t<is_copy_constructible<_InIter>::value
|
||||
&& is_copy_constructible<_Sent>::value
|
||||
&& is_copy_constructible<_OutIter>::value, pair<_InIter, _OutIter> >
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
__move(_InIter __first, _Sent __last, _OutIter __result) {
|
||||
auto __ret = std::__move_impl<_AlgPolicy>(
|
||||
std::__unwrap_iter(__first), std::__unwrap_iter(__last), std::__unwrap_iter(__result));
|
||||
return std::make_pair(std::__rewrap_iter(__first, __ret.first), std::__rewrap_iter(__result, __ret.second));
|
||||
}
|
||||
|
||||
template <class _AlgPolicy, class _InIter, class _Sent, class _OutIter>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
__enable_if_t<!is_copy_constructible<_InIter>::value
|
||||
|| !is_copy_constructible<_Sent>::value
|
||||
|| !is_copy_constructible<_OutIter>::value, pair<_InIter, _OutIter> >
|
||||
__move(_InIter __first, _Sent __last, _OutIter __result) {
|
||||
return std::__move_impl<_AlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
|
||||
return std::__dispatch_copy_or_move<_AlgPolicy, __move_loop<_AlgPolicy>, __move_trivial>(
|
||||
std::move(__first), std::move(__last), std::move(__result));
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
|
||||
return std::__move<_ClassicAlgPolicy>(__first, __last, __result).second;
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
|
||||
move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) {
|
||||
static_assert(is_copy_constructible<_InputIterator>::value, "Iterators has to be copy constructible.");
|
||||
static_assert(is_copy_constructible<_OutputIterator>::value, "The output iterator has to be copy constructible.");
|
||||
|
||||
return std::__move<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second;
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_MOVE_H
|
||||
|
|
|
|||
160
lib/libcxx/include/__algorithm/move_backward.h
vendored
160
lib/libcxx/include/__algorithm/move_backward.h
vendored
|
|
@ -9,81 +9,131 @@
|
|||
#ifndef _LIBCPP___ALGORITHM_MOVE_BACKWARD_H
|
||||
#define _LIBCPP___ALGORITHM_MOVE_BACKWARD_H
|
||||
|
||||
#include <__algorithm/copy_move_common.h>
|
||||
#include <__algorithm/iterator_operations.h>
|
||||
#include <__algorithm/unwrap_iter.h>
|
||||
#include <__algorithm/min.h>
|
||||
#include <__config>
|
||||
#include <__iterator/segmented_iterator.h>
|
||||
#include <__type_traits/common_type.h>
|
||||
#include <__type_traits/is_copy_constructible.h>
|
||||
#include <__utility/move.h>
|
||||
#include <cstring>
|
||||
#include <type_traits>
|
||||
#include <__utility/pair.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _AlgPolicy, class _InputIterator, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
_OutputIterator
|
||||
__move_backward_constexpr(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
|
||||
{
|
||||
while (__first != __last)
|
||||
*--__result = _IterOps<_AlgPolicy>::__iter_move(--__last);
|
||||
return __result;
|
||||
}
|
||||
template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2>
|
||||
__move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result);
|
||||
|
||||
template <class _AlgPolicy, class _InputIterator, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
_OutputIterator
|
||||
__move_backward_impl(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
|
||||
{
|
||||
return _VSTD::__move_backward_constexpr<_AlgPolicy>(__first, __last, __result);
|
||||
}
|
||||
template <class _AlgPolicy>
|
||||
struct __move_backward_loop {
|
||||
template <class _InIter, class _Sent, class _OutIter>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _Sent __last, _OutIter __result) const {
|
||||
auto __last_iter = _IterOps<_AlgPolicy>::next(__first, __last);
|
||||
auto __original_last_iter = __last_iter;
|
||||
|
||||
template <class _AlgPolicy, class _Tp, class _Up>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
typename enable_if
|
||||
<
|
||||
is_same<typename remove_const<_Tp>::type, _Up>::value &&
|
||||
is_trivially_move_assignable<_Up>::value,
|
||||
_Up*
|
||||
>::type
|
||||
__move_backward_impl(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
{
|
||||
const size_t __n = static_cast<size_t>(__last - __first);
|
||||
if (__n > 0)
|
||||
{
|
||||
__result -= __n;
|
||||
_VSTD::memmove(__result, __first, __n * sizeof(_Up));
|
||||
while (__first != __last_iter) {
|
||||
*--__result = _IterOps<_AlgPolicy>::__iter_move(--__last_iter);
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _AlgPolicy, class _BidirectionalIterator1, class _BidirectionalIterator2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_BidirectionalIterator2
|
||||
__move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
|
||||
_BidirectionalIterator2 __result)
|
||||
{
|
||||
if (__libcpp_is_constant_evaluated()) {
|
||||
return _VSTD::__move_backward_constexpr<_AlgPolicy>(__first, __last, __result);
|
||||
} else {
|
||||
return _VSTD::__rewrap_iter(__result,
|
||||
_VSTD::__move_backward_impl<_AlgPolicy>(_VSTD::__unwrap_iter(__first),
|
||||
_VSTD::__unwrap_iter(__last),
|
||||
_VSTD::__unwrap_iter(__result)));
|
||||
return std::make_pair(std::move(__original_last_iter), std::move(__result));
|
||||
}
|
||||
|
||||
template <class _InIter, class _OutIter, __enable_if_t<__is_segmented_iterator<_InIter>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _InIter __last, _OutIter __result) const {
|
||||
using _Traits = __segmented_iterator_traits<_InIter>;
|
||||
auto __sfirst = _Traits::__segment(__first);
|
||||
auto __slast = _Traits::__segment(__last);
|
||||
if (__sfirst == __slast) {
|
||||
auto __iters =
|
||||
std::__move_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__local(__last), std::move(__result));
|
||||
return std::make_pair(__last, __iters.second);
|
||||
}
|
||||
|
||||
__result =
|
||||
std::__move_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__local(__last), std::move(__result))
|
||||
.second;
|
||||
--__slast;
|
||||
while (__sfirst != __slast) {
|
||||
__result =
|
||||
std::__move_backward<_AlgPolicy>(_Traits::__begin(__slast), _Traits::__end(__slast), std::move(__result))
|
||||
.second;
|
||||
--__slast;
|
||||
}
|
||||
__result = std::__move_backward<_AlgPolicy>(_Traits::__local(__first), _Traits::__end(__slast), std::move(__result))
|
||||
.second;
|
||||
return std::make_pair(__last, std::move(__result));
|
||||
}
|
||||
|
||||
template <class _InIter,
|
||||
class _OutIter,
|
||||
__enable_if_t<__is_cpp17_random_access_iterator<_InIter>::value &&
|
||||
!__is_segmented_iterator<_InIter>::value && __is_segmented_iterator<_OutIter>::value,
|
||||
int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_InIter, _OutIter>
|
||||
operator()(_InIter __first, _InIter __last, _OutIter __result) {
|
||||
using _Traits = __segmented_iterator_traits<_OutIter>;
|
||||
using _DiffT = typename common_type<__iter_diff_t<_InIter>, __iter_diff_t<_OutIter> >::type;
|
||||
|
||||
// When the range contains no elements, __result might not be a valid iterator
|
||||
if (__first == __last)
|
||||
return std::make_pair(__first, __result);
|
||||
|
||||
auto __orig_last = __last;
|
||||
|
||||
auto __local_last = _Traits::__local(__result);
|
||||
auto __segment_iterator = _Traits::__segment(__result);
|
||||
while (true) {
|
||||
auto __local_first = _Traits::__begin(__segment_iterator);
|
||||
auto __size = std::min<_DiffT>(__local_last - __local_first, __last - __first);
|
||||
auto __iter = std::__move_backward<_AlgPolicy>(__last - __size, __last, __local_last).second;
|
||||
__last -= __size;
|
||||
|
||||
if (__first == __last)
|
||||
return std::make_pair(std::move(__orig_last), _Traits::__compose(__segment_iterator, std::move(__iter)));
|
||||
|
||||
__local_last = _Traits::__end(--__segment_iterator);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct __move_backward_trivial {
|
||||
// At this point, the iterators have been unwrapped so any `contiguous_iterator` has been unwrapped to a pointer.
|
||||
template <class _In, class _Out,
|
||||
__enable_if_t<__can_lower_move_assignment_to_memmove<_In, _Out>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<_In*, _Out*>
|
||||
operator()(_In* __first, _In* __last, _Out* __result) const {
|
||||
return std::__copy_backward_trivial_impl(__first, __last, __result);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _AlgPolicy, class _BidirectionalIterator1, class _Sentinel, class _BidirectionalIterator2>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator1, _BidirectionalIterator2>
|
||||
__move_backward(_BidirectionalIterator1 __first, _Sentinel __last, _BidirectionalIterator2 __result) {
|
||||
static_assert(std::is_copy_constructible<_BidirectionalIterator1>::value &&
|
||||
std::is_copy_constructible<_BidirectionalIterator1>::value, "Iterators must be copy constructible.");
|
||||
|
||||
return std::__dispatch_copy_or_move<_AlgPolicy, __move_backward_loop<_AlgPolicy>, __move_backward_trivial>(
|
||||
std::move(__first), std::move(__last), std::move(__result));
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator1, class _BidirectionalIterator2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_BidirectionalIterator2
|
||||
move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
|
||||
_BidirectionalIterator2 __result)
|
||||
{
|
||||
return std::__move_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _BidirectionalIterator2
|
||||
move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) {
|
||||
return std::__move_backward<_ClassicAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)).second;
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_MOVE_BACKWARD_H
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
pair<_BidirectionalIterator, bool>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator, bool>
|
||||
__next_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp)
|
||||
{
|
||||
using _Result = pair<_BidirectionalIterator, bool>;
|
||||
|
|
@ -57,17 +56,16 @@ __next_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&&
|
|||
}
|
||||
|
||||
template <class _BidirectionalIterator, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
|
||||
{
|
||||
using _Comp_ref = typename __comp_ref_type<_Compare>::type;
|
||||
return std::__next_permutation<_ClassicAlgPolicy>(
|
||||
std::move(__first), std::move(__last), static_cast<_Comp_ref>(__comp)).second;
|
||||
std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp)).second;
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
|
||||
{
|
||||
|
|
|
|||
2
lib/libcxx/include/__algorithm/none_of.h
vendored
2
lib/libcxx/include/__algorithm/none_of.h
vendored
|
|
@ -19,7 +19,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Predicate>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 bool
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
|
||||
none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) {
|
||||
for (; __first != __last; ++__first)
|
||||
if (__pred(*__first))
|
||||
|
|
|
|||
13
lib/libcxx/include/__algorithm/nth_element.h
vendored
13
lib/libcxx/include/__algorithm/nth_element.h
vendored
|
|
@ -26,7 +26,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<class _Compare, class _RandomAccessIterator>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 bool
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
|
||||
__nth_element_find_guard(_RandomAccessIterator& __i, _RandomAccessIterator& __j,
|
||||
_RandomAccessIterator __m, _Compare __comp)
|
||||
{
|
||||
|
|
@ -42,7 +42,7 @@ __nth_element_find_guard(_RandomAccessIterator& __i, _RandomAccessIterator& __j,
|
|||
}
|
||||
|
||||
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 void
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
|
||||
__nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
|
||||
{
|
||||
using _Ops = _IterOps<_AlgPolicy>;
|
||||
|
|
@ -223,7 +223,7 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
|
|||
}
|
||||
|
||||
template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last,
|
||||
_Compare& __comp) {
|
||||
if (__nth == __last)
|
||||
|
|
@ -231,8 +231,7 @@ void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __n
|
|||
|
||||
std::__debug_randomize_range<_AlgPolicy>(__first, __last);
|
||||
|
||||
using _Comp_ref = typename __comp_ref_type<_Compare>::type;
|
||||
std::__nth_element<_AlgPolicy, _Comp_ref>(__first, __nth, __last, __comp);
|
||||
std::__nth_element<_AlgPolicy, __comp_ref_type<_Compare> >(__first, __nth, __last, __comp);
|
||||
|
||||
std::__debug_randomize_range<_AlgPolicy>(__first, __nth);
|
||||
if (__nth != __last) {
|
||||
|
|
@ -241,14 +240,14 @@ void __nth_element_impl(_RandomAccessIterator __first, _RandomAccessIterator __n
|
|||
}
|
||||
|
||||
template <class _RandomAccessIterator, class _Compare>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last,
|
||||
_Compare __comp) {
|
||||
std::__nth_element_impl<_ClassicAlgPolicy>(std::move(__first), std::move(__nth), std::move(__last), __comp);
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last) {
|
||||
std::nth_element(std::move(__first), std::move(__nth), std::move(__last), __less<typename
|
||||
iterator_traits<_RandomAccessIterator>::value_type>());
|
||||
|
|
|
|||
13
lib/libcxx/include/__algorithm/partial_sort.h
vendored
13
lib/libcxx/include/__algorithm/partial_sort.h
vendored
|
|
@ -29,7 +29,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_RandomAccessIterator __partial_sort_impl(
|
||||
_RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last, _Compare&& __comp) {
|
||||
if (__first == __middle) {
|
||||
|
|
@ -47,7 +47,6 @@ _RandomAccessIterator __partial_sort_impl(
|
|||
_IterOps<_AlgPolicy>::iter_swap(__i, __first);
|
||||
std::__sift_down<_AlgPolicy>(__first, __comp, __len, __first);
|
||||
}
|
||||
|
||||
}
|
||||
std::__sort_heap<_AlgPolicy>(std::move(__first), std::move(__middle), __comp);
|
||||
|
||||
|
|
@ -55,7 +54,7 @@ _RandomAccessIterator __partial_sort_impl(
|
|||
}
|
||||
|
||||
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator, class _Sentinel>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Sentinel __last,
|
||||
_Compare& __comp) {
|
||||
if (__first == __middle)
|
||||
|
|
@ -63,8 +62,8 @@ _RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAcces
|
|||
|
||||
std::__debug_randomize_range<_AlgPolicy>(__first, __last);
|
||||
|
||||
using _Comp_ref = typename __comp_ref_type<_Compare>::type;
|
||||
auto __last_iter = std::__partial_sort_impl<_AlgPolicy>(__first, __middle, __last, static_cast<_Comp_ref>(__comp));
|
||||
auto __last_iter =
|
||||
std::__partial_sort_impl<_AlgPolicy>(__first, __middle, __last, static_cast<__comp_ref_type<_Compare> >(__comp));
|
||||
|
||||
std::__debug_randomize_range<_AlgPolicy>(__middle, __last);
|
||||
|
||||
|
|
@ -72,7 +71,7 @@ _RandomAccessIterator __partial_sort(_RandomAccessIterator __first, _RandomAcces
|
|||
}
|
||||
|
||||
template <class _RandomAccessIterator, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void
|
||||
partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
|
||||
_Compare __comp)
|
||||
|
|
@ -84,7 +83,7 @@ partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran
|
|||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void
|
||||
partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
template <class _AlgPolicy, class _Compare,
|
||||
class _InputIterator, class _Sentinel1, class _RandomAccessIterator, class _Sentinel2,
|
||||
class _Proj1, class _Proj2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_InputIterator, _RandomAccessIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator, _RandomAccessIterator>
|
||||
__partial_sort_copy(_InputIterator __first, _Sentinel1 __last,
|
||||
_RandomAccessIterator __result_first, _Sentinel2 __result_last,
|
||||
_Compare&& __comp, _Proj1&& __proj1, _Proj2&& __proj2)
|
||||
|
|
@ -60,7 +60,7 @@ __partial_sort_copy(_InputIterator __first, _Sentinel1 __last,
|
|||
}
|
||||
|
||||
template <class _InputIterator, class _RandomAccessIterator, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_RandomAccessIterator
|
||||
partial_sort_copy(_InputIterator __first, _InputIterator __last,
|
||||
_RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
|
||||
|
|
@ -68,14 +68,13 @@ partial_sort_copy(_InputIterator __first, _InputIterator __last,
|
|||
static_assert(__is_callable<_Compare, decltype(*__first), decltype(*__result_first)>::value,
|
||||
"Comparator has to be callable");
|
||||
|
||||
using _Comp_ref = typename __comp_ref_type<_Compare>::type;
|
||||
auto __result = std::__partial_sort_copy<_ClassicAlgPolicy>(__first, __last, __result_first, __result_last,
|
||||
static_cast<_Comp_ref>(__comp), __identity(), __identity());
|
||||
static_cast<__comp_ref_type<_Compare> >(__comp), __identity(), __identity());
|
||||
return __result.second;
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _RandomAccessIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_RandomAccessIterator
|
||||
partial_sort_copy(_InputIterator __first, _InputIterator __last,
|
||||
_RandomAccessIterator __result_first, _RandomAccessIterator __result_last)
|
||||
|
|
|
|||
10
lib/libcxx/include/__algorithm/partition.h
vendored
10
lib/libcxx/include/__algorithm/partition.h
vendored
|
|
@ -23,7 +23,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Predicate, class _AlgPolicy, class _ForwardIterator, class _Sentinel>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_ForwardIterator, _ForwardIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
|
||||
__partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred, forward_iterator_tag)
|
||||
{
|
||||
while (true)
|
||||
|
|
@ -48,7 +48,7 @@ __partition_impl(_ForwardIterator __first, _Sentinel __last, _Predicate __pred,
|
|||
}
|
||||
|
||||
template <class _Predicate, class _AlgPolicy, class _BidirectionalIterator, class _Sentinel>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_BidirectionalIterator, _BidirectionalIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_BidirectionalIterator, _BidirectionalIterator>
|
||||
__partition_impl(_BidirectionalIterator __first, _Sentinel __sentinel, _Predicate __pred,
|
||||
bidirectional_iterator_tag)
|
||||
{
|
||||
|
|
@ -76,15 +76,15 @@ __partition_impl(_BidirectionalIterator __first, _Sentinel __sentinel, _Predicat
|
|||
}
|
||||
|
||||
template <class _AlgPolicy, class _ForwardIterator, class _Sentinel, class _Predicate, class _IterCategory>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
pair<_ForwardIterator, _ForwardIterator> __partition(
|
||||
_ForwardIterator __first, _Sentinel __last, _Predicate&& __pred, _IterCategory __iter_category) {
|
||||
return std::__partition_impl<__uncvref_t<_Predicate>&, _AlgPolicy>(
|
||||
return std::__partition_impl<__remove_cvref_t<_Predicate>&, _AlgPolicy>(
|
||||
std::move(__first), std::move(__last), __pred, __iter_category);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_ForwardIterator
|
||||
partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
template <class _InputIterator, class _OutputIterator1,
|
||||
class _OutputIterator2, class _Predicate>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 pair<_OutputIterator1, _OutputIterator2>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_OutputIterator1, _OutputIterator2>
|
||||
partition_copy(_InputIterator __first, _InputIterator __last,
|
||||
_OutputIterator1 __out_true, _OutputIterator2 __out_false,
|
||||
_Predicate __pred)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<class _ForwardIterator, class _Predicate>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 _ForwardIterator
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
|
||||
partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
|
||||
{
|
||||
typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
|
||||
|
|
|
|||
9
lib/libcxx/include/__algorithm/pop_heap.h
vendored
9
lib/libcxx/include/__algorithm/pop_heap.h
vendored
|
|
@ -27,13 +27,12 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp,
|
||||
typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
|
||||
_LIBCPP_ASSERT(__len > 0, "The heap given to pop_heap must be non-empty");
|
||||
|
||||
using _CompRef = typename __comp_ref_type<_Compare>::type;
|
||||
_CompRef __comp_ref = __comp;
|
||||
__comp_ref_type<_Compare> __comp_ref = __comp;
|
||||
|
||||
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
|
||||
if (__len > 1) {
|
||||
|
|
@ -53,7 +52,7 @@ void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Co
|
|||
}
|
||||
|
||||
template <class _RandomAccessIterator, class _Compare>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
|
||||
static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
|
||||
static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
|
||||
|
|
@ -63,7 +62,7 @@ void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp
|
|||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
|
||||
std::pop_heap(std::move(__first), std::move(__last),
|
||||
__less<typename iterator_traits<_RandomAccessIterator>::value_type>());
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _AlgPolicy, class _Compare, class _BidirectionalIterator, class _Sentinel>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
pair<_BidirectionalIterator, bool>
|
||||
__prev_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&& __comp)
|
||||
{
|
||||
|
|
@ -57,17 +57,16 @@ __prev_permutation(_BidirectionalIterator __first, _Sentinel __last, _Compare&&
|
|||
}
|
||||
|
||||
template <class _BidirectionalIterator, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
|
||||
{
|
||||
using _Comp_ref = typename __comp_ref_type<_Compare>::type;
|
||||
return std::__prev_permutation<_ClassicAlgPolicy>(
|
||||
std::move(__first), std::move(__last), static_cast<_Comp_ref>(__comp)).second;
|
||||
std::move(__first), std::move(__last), static_cast<__comp_ref_type<_Compare> >(__comp)).second;
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
bool
|
||||
prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
|
||||
{
|
||||
|
|
|
|||
11
lib/libcxx/include/__algorithm/push_heap.h
vendored
11
lib/libcxx/include/__algorithm/push_heap.h
vendored
|
|
@ -24,7 +24,7 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp,
|
||||
typename iterator_traits<_RandomAccessIterator>::difference_type __len) {
|
||||
using value_type = typename iterator_traits<_RandomAccessIterator>::value_type;
|
||||
|
|
@ -50,15 +50,14 @@ void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
|
|||
}
|
||||
|
||||
template <class _AlgPolicy, class _RandomAccessIterator, class _Compare>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
void __push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp) {
|
||||
using _CompRef = typename __comp_ref_type<_Compare>::type;
|
||||
typename iterator_traits<_RandomAccessIterator>::difference_type __len = __last - __first;
|
||||
std::__sift_up<_AlgPolicy, _CompRef>(std::move(__first), std::move(__last), __comp, __len);
|
||||
std::__sift_up<_AlgPolicy, __comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp, __len);
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator, class _Compare>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
|
||||
static_assert(std::is_copy_constructible<_RandomAccessIterator>::value, "Iterators must be copy constructible.");
|
||||
static_assert(std::is_copy_assignable<_RandomAccessIterator>::value, "Iterators must be copy assignable.");
|
||||
|
|
@ -67,7 +66,7 @@ void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Com
|
|||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) {
|
||||
std::push_heap(std::move(__first), std::move(__last),
|
||||
__less<typename iterator_traits<_RandomAccessIterator>::value_type>());
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ struct __fn {
|
|||
template <forward_iterator _Iter, sentinel_for<_Iter> _Sent,
|
||||
class _Proj = identity,
|
||||
indirect_binary_predicate<projected<_Iter, _Proj>, projected<_Iter, _Proj>> _Pred = ranges::equal_to>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_Iter operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {
|
||||
return __adjacent_find_impl(std::move(__first), std::move(__last), __pred, __proj);
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ struct __fn {
|
|||
class _Proj = identity,
|
||||
indirect_binary_predicate<projected<iterator_t<_Range>, _Proj>,
|
||||
projected<iterator_t<_Range>, _Proj>> _Pred = ranges::equal_to>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
borrowed_iterator_t<_Range> operator()(_Range&& __range, _Pred __pred = {}, _Proj __proj = {}) const {
|
||||
return __adjacent_find_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
|
||||
}
|
||||
|
|
@ -73,6 +73,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_ADJACENT_FIND_H
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -42,14 +42,14 @@ struct __fn {
|
|||
|
||||
template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
|
||||
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
|
||||
return __all_of_impl(std::move(__first), std::move(__last), __pred, __proj);
|
||||
}
|
||||
|
||||
template <input_range _Range, class _Proj = identity,
|
||||
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
|
||||
return __all_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
|
||||
}
|
||||
|
|
@ -63,6 +63,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_ALL_OF_H
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -42,14 +42,14 @@ struct __fn {
|
|||
|
||||
template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
|
||||
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {
|
||||
return __any_of_impl(std::move(__first), std::move(__last), __pred, __proj);
|
||||
}
|
||||
|
||||
template <input_range _Range, class _Proj = identity,
|
||||
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
|
||||
return __any_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
|
||||
}
|
||||
|
|
@ -63,6 +63,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_ANY_OF_H
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ namespace __binary_search {
|
|||
struct __fn {
|
||||
template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity,
|
||||
indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
|
||||
auto __ret = std::__lower_bound_impl<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
|
||||
return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__first));
|
||||
|
|
@ -41,7 +41,7 @@ struct __fn {
|
|||
|
||||
template <forward_range _Range, class _Type, class _Proj = identity,
|
||||
indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
|
||||
auto __first = ranges::begin(__r);
|
||||
auto __last = ranges::end(__r);
|
||||
|
|
@ -58,6 +58,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_BINARY_SEARCH_H
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ struct __fn {
|
|||
template <class _Type,
|
||||
class _Proj = identity,
|
||||
indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
const _Type& operator()(const _Type& __value,
|
||||
const _Type& __low,
|
||||
const _Type& __high,
|
||||
|
|
@ -60,6 +60,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_CLAMP_H
|
||||
|
|
|
|||
10
lib/libcxx/include/__algorithm/ranges_copy.h
vendored
10
lib/libcxx/include/__algorithm/ranges_copy.h
vendored
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <__algorithm/copy.h>
|
||||
#include <__algorithm/in_out_result.h>
|
||||
#include <__algorithm/iterator_operations.h>
|
||||
#include <__config>
|
||||
#include <__functional/identity.h>
|
||||
#include <__iterator/concepts.h>
|
||||
|
|
@ -18,12 +19,13 @@
|
|||
#include <__ranges/concepts.h>
|
||||
#include <__ranges/dangling.h>
|
||||
#include <__utility/move.h>
|
||||
#include <__utility/pair.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -39,7 +41,7 @@ struct __fn {
|
|||
requires indirectly_copyable<_InIter, _OutIter>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
copy_result<_InIter, _OutIter> operator()(_InIter __first, _Sent __last, _OutIter __result) const {
|
||||
auto __ret = std::__copy(std::move(__first), std::move(__last), std::move(__result));
|
||||
auto __ret = std::__copy<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
|
||||
return {std::move(__ret.first), std::move(__ret.second)};
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +49,7 @@ struct __fn {
|
|||
requires indirectly_copyable<iterator_t<_Range>, _OutIter>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
copy_result<borrowed_iterator_t<_Range>, _OutIter> operator()(_Range&& __r, _OutIter __result) const {
|
||||
auto __ret = std::__copy(ranges::begin(__r), ranges::end(__r), std::move(__result));
|
||||
auto __ret = std::__copy<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), std::move(__result));
|
||||
return {std::move(__ret.first), std::move(__ret.second)};
|
||||
}
|
||||
};
|
||||
|
|
@ -60,6 +62,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_COPY_H
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
#include <__algorithm/iterator_operations.h>
|
||||
#include <__config>
|
||||
#include <__iterator/concepts.h>
|
||||
#include <__iterator/reverse_iterator.h>
|
||||
#include <__ranges/access.h>
|
||||
#include <__ranges/concepts.h>
|
||||
#include <__ranges/dangling.h>
|
||||
|
|
@ -24,7 +23,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -61,6 +60,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_COPY_BACKWARD_H
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -76,6 +76,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_COPY_IF_H
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <__algorithm/copy.h>
|
||||
#include <__algorithm/in_out_result.h>
|
||||
#include <__algorithm/iterator_operations.h>
|
||||
#include <__algorithm/ranges_copy.h>
|
||||
#include <__config>
|
||||
#include <__functional/identity.h>
|
||||
|
|
@ -26,7 +27,7 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
namespace ranges {
|
||||
|
||||
|
|
@ -51,7 +52,7 @@ struct __fn {
|
|||
template <random_access_iterator _InIter, class _DiffType, random_access_iterator _OutIter>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr static
|
||||
copy_n_result<_InIter, _OutIter> __go(_InIter __first, _DiffType __n, _OutIter __result) {
|
||||
auto __ret = std::__copy(__first, __first + __n, __result);
|
||||
auto __ret = std::__copy<_RangeAlgPolicy>(__first, __first + __n, __result);
|
||||
return {__ret.first, __ret.second};
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ inline namespace __cpo {
|
|||
} // namespace __cpo
|
||||
} // namespace ranges
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ namespace __count {
|
|||
struct __fn {
|
||||
template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity>
|
||||
requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
iter_difference_t<_Iter> operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) const {
|
||||
auto __pred = [&](auto&& __e) { return __e == __value; };
|
||||
return ranges::__count_if_impl(std::move(__first), std::move(__last), __pred, __proj);
|
||||
|
|
@ -42,7 +42,7 @@ struct __fn {
|
|||
|
||||
template <input_range _Range, class _Type, class _Proj = identity>
|
||||
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
range_difference_t<_Range> operator()(_Range&& __r, const _Type& __value, _Proj __proj = {}) const {
|
||||
auto __pred = [&](auto&& __e) { return __e == __value; };
|
||||
return ranges::__count_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
|
||||
|
|
@ -57,6 +57,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_COUNT_H
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -46,14 +46,14 @@ namespace __count_if {
|
|||
struct __fn {
|
||||
template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
|
||||
indirect_unary_predicate<projected<_Iter, _Proj>> _Predicate>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
iter_difference_t<_Iter> operator()(_Iter __first, _Sent __last, _Predicate __pred, _Proj __proj = {}) const {
|
||||
return ranges::__count_if_impl(std::move(__first), std::move(__last), __pred, __proj);
|
||||
}
|
||||
|
||||
template <input_range _Range, class _Proj = identity,
|
||||
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Predicate>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
range_difference_t<_Range> operator()(_Range&& __r, _Predicate __pred, _Proj __proj = {}) const {
|
||||
return ranges::__count_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
|
||||
}
|
||||
|
|
@ -67,6 +67,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_COUNT_IF_H
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ public:
|
|||
class _Proj1 = identity,
|
||||
class _Proj2 = identity>
|
||||
requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Iter1 __first1, _Sent1 __last1,
|
||||
_Iter2 __first2, _Sent2 __last2,
|
||||
_Pred __pred = {},
|
||||
|
|
@ -83,7 +83,7 @@ public:
|
|||
class _Proj1 = identity,
|
||||
class _Proj2 = identity>
|
||||
requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Range1&& __range1,
|
||||
_Range2&& __range2,
|
||||
_Pred __pred = {},
|
||||
|
|
@ -110,6 +110,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_EQUAL_H
|
||||
|
|
|
|||
|
|
@ -24,12 +24,13 @@
|
|||
#include <__ranges/subrange.h>
|
||||
#include <__utility/forward.h>
|
||||
#include <__utility/move.h>
|
||||
#include <__utility/pair.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ struct __fn {
|
|||
class _Tp,
|
||||
class _Proj = identity,
|
||||
indirect_strict_weak_order<const _Tp*, projected<_Iter, _Proj>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
|
||||
operator()(_Iter __first, _Sent __last, const _Tp& __value, _Comp __comp = {}, _Proj __proj = {}) const {
|
||||
auto __ret = std::__equal_range<_RangeAlgPolicy>(
|
||||
std::move(__first), std::move(__last), __value, __comp, __proj);
|
||||
|
|
@ -55,7 +56,7 @@ struct __fn {
|
|||
class _Tp,
|
||||
class _Proj = identity,
|
||||
indirect_strict_weak_order<const _Tp*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
|
||||
operator()(_Range&& __range, const _Tp& __value, _Comp __comp = {}, _Proj __proj = {}) const {
|
||||
auto __ret = std::__equal_range<_RangeAlgPolicy>(
|
||||
ranges::begin(__range), ranges::end(__range), __value, __comp, __proj);
|
||||
|
|
@ -72,6 +73,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_EQUAL_RANGE_H
|
||||
|
|
|
|||
4
lib/libcxx/include/__algorithm/ranges_fill.h
vendored
4
lib/libcxx/include/__algorithm/ranges_fill.h
vendored
|
|
@ -20,7 +20,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -54,6 +54,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_FILL_H
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -43,6 +43,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_FILL_N_H
|
||||
|
|
|
|||
8
lib/libcxx/include/__algorithm/ranges_find.h
vendored
8
lib/libcxx/include/__algorithm/ranges_find.h
vendored
|
|
@ -26,7 +26,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ namespace __find {
|
|||
struct __fn {
|
||||
template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, class _Proj = identity>
|
||||
requires indirect_binary_predicate<ranges::equal_to, projected<_Ip, _Proj>, const _Tp*>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_Ip operator()(_Ip __first, _Sp __last, const _Tp& __value, _Proj __proj = {}) const {
|
||||
auto __pred = [&](auto&& __e) { return std::forward<decltype(__e)>(__e) == __value; };
|
||||
return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj);
|
||||
|
|
@ -43,7 +43,7 @@ struct __fn {
|
|||
|
||||
template <input_range _Rp, class _Tp, class _Proj = identity>
|
||||
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Rp>, _Proj>, const _Tp*>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
borrowed_iterator_t<_Rp> operator()(_Rp&& __r, const _Tp& __value, _Proj __proj = {}) const {
|
||||
auto __pred = [&](auto&& __e) { return std::forward<decltype(__e)>(__e) == __value; };
|
||||
return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
|
||||
|
|
@ -58,6 +58,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_FIND_H
|
||||
|
|
|
|||
|
|
@ -21,12 +21,13 @@
|
|||
#include <__ranges/access.h>
|
||||
#include <__ranges/concepts.h>
|
||||
#include <__ranges/subrange.h>
|
||||
#include <__utility/pair.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ struct __fn {
|
|||
class _Proj1 = identity,
|
||||
class _Proj2 = identity>
|
||||
requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
subrange<_Iter1> operator()(_Iter1 __first1, _Sent1 __last1,
|
||||
_Iter2 __first2, _Sent2 __last2,
|
||||
_Pred __pred = {},
|
||||
|
|
@ -64,7 +65,7 @@ struct __fn {
|
|||
class _Proj1 = identity,
|
||||
class _Proj2 = identity>
|
||||
requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
borrowed_subrange_t<_Range1> operator()(_Range1&& __range1,
|
||||
_Range2&& __range2,
|
||||
_Pred __pred = {},
|
||||
|
|
@ -92,6 +93,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_FIND_END_H
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ struct __fn {
|
|||
class _Proj1 = identity,
|
||||
class _Proj2 = identity>
|
||||
requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_Iter1 operator()(_Iter1 __first1, _Sent1 __last1,
|
||||
_Iter2 __first2, _Sent2 __last2,
|
||||
_Pred __pred = {},
|
||||
|
|
@ -73,7 +73,7 @@ struct __fn {
|
|||
class _Proj1 = identity,
|
||||
class _Proj2 = identity>
|
||||
requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
borrowed_iterator_t<_Range1> operator()(_Range1&& __range1,
|
||||
_Range2&& __range2,
|
||||
_Pred __pred = {},
|
||||
|
|
@ -96,6 +96,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_FIND_FIRST_OF_H
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -45,14 +45,14 @@ struct __fn {
|
|||
|
||||
template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity,
|
||||
indirect_unary_predicate<projected<_Ip, _Proj>> _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_Ip operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
|
||||
return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj);
|
||||
}
|
||||
|
||||
template <input_range _Rp, class _Proj = identity,
|
||||
indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const {
|
||||
return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
|
||||
}
|
||||
|
|
@ -66,6 +66,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_H
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ namespace __find_if_not {
|
|||
struct __fn {
|
||||
template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity,
|
||||
indirect_unary_predicate<projected<_Ip, _Proj>> _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_Ip operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
|
||||
auto __pred2 = [&](auto&& __e) { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); };
|
||||
return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred2, __proj);
|
||||
|
|
@ -43,7 +43,7 @@ struct __fn {
|
|||
|
||||
template <input_range _Rp, class _Proj = identity,
|
||||
indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const {
|
||||
auto __pred2 = [&](auto&& __e) { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); };
|
||||
return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred2, __proj);
|
||||
|
|
@ -58,6 +58,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -73,6 +73,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_H
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -61,6 +61,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_N_H
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -68,6 +68,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_H
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -57,6 +57,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ struct __fn {
|
|||
class _Proj1 = identity,
|
||||
class _Proj2 = identity,
|
||||
indirect_strict_weak_order<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
|
||||
_Iter1 __first1,
|
||||
_Sent1 __last1,
|
||||
_Iter2 __first2,
|
||||
|
|
@ -68,7 +68,7 @@ struct __fn {
|
|||
class _Proj2 = identity,
|
||||
indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>>
|
||||
_Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
|
||||
_Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
|
||||
return std::__includes(
|
||||
ranges::begin(__range1),
|
||||
|
|
@ -90,6 +90,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_INCLUDES_H
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -80,6 +80,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_INPLACE_MERGE_H
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -47,14 +47,14 @@ struct __fn {
|
|||
|
||||
template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
|
||||
indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
|
||||
return __is_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
|
||||
}
|
||||
|
||||
template <random_access_range _Range, class _Proj = identity,
|
||||
indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
|
||||
return __is_heap_fn_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj);
|
||||
}
|
||||
|
|
@ -69,6 +69,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_IS_HEAP_H
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -47,14 +47,14 @@ struct __fn {
|
|||
|
||||
template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
|
||||
indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
|
||||
return __is_heap_until_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
|
||||
}
|
||||
|
||||
template <random_access_range _Range, class _Proj = identity,
|
||||
indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
borrowed_iterator_t<_Range> operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
|
||||
return __is_heap_until_fn_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj);
|
||||
}
|
||||
|
|
@ -70,6 +70,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_IS_HEAP_UNTIL_H
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ struct __fn {
|
|||
template <input_iterator _Iter, sentinel_for<_Iter> _Sent,
|
||||
class _Proj = identity,
|
||||
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
|
||||
return __is_parititioned_impl(std::move(__first), std::move(__last), __pred, __proj);
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ struct __fn {
|
|||
template <input_range _Range,
|
||||
class _Proj = identity,
|
||||
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
|
||||
return __is_parititioned_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
|
||||
}
|
||||
|
|
@ -76,6 +76,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_IS_PARTITIONED_H
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ struct __fn {
|
|||
class _Proj2 = identity,
|
||||
indirect_equivalence_relation<projected<_Iter1, _Proj1>,
|
||||
projected<_Iter2, _Proj2>> _Pred = ranges::equal_to>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
|
||||
_Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
|
||||
return __is_permutation_func_impl(
|
||||
|
|
@ -62,7 +62,7 @@ struct __fn {
|
|||
class _Proj1 = identity,
|
||||
class _Proj2 = identity,
|
||||
indirect_equivalence_relation<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>> _Pred = ranges::equal_to>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Range1&& __range1, _Range2&& __range2,
|
||||
_Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
|
||||
if constexpr (sized_range<_Range1> && sized_range<_Range2>) {
|
||||
|
|
@ -84,6 +84,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_IS_PERMUTATION_H
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ struct __fn {
|
|||
template <forward_iterator _Iter, sentinel_for<_Iter> _Sent,
|
||||
class _Proj = identity,
|
||||
indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
|
||||
return ranges::__is_sorted_until_impl(std::move(__first), __last, __comp, __proj) == __last;
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ struct __fn {
|
|||
template <forward_range _Range,
|
||||
class _Proj = identity,
|
||||
indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
|
||||
bool operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
|
||||
auto __last = ranges::end(__range);
|
||||
return ranges::__is_sorted_until_impl(ranges::begin(__range), __last, __comp, __proj) == __last;
|
||||
|
|
@ -56,6 +56,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
#endif // _LIBCPP__ALGORITHM_RANGES_IS_SORTED_H
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue