mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-03 11:12:27 +00:00
Release Cosmopolitan v3.6.0
This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
parent
62ace3623a
commit
5660ec4741
1585 changed files with 117353 additions and 271644 deletions
23
third_party/libcxx/__iterator/prev.h
vendored
23
third_party/libcxx/__iterator/prev.h
vendored
|
@ -24,13 +24,14 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIter>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
|
||||
typename enable_if<__has_input_iterator_category<_InputIter>::value, _InputIter>::type
|
||||
prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) {
|
||||
_LIBCPP_ASSERT(__n <= 0 || __has_bidirectional_iterator_category<_InputIter>::value,
|
||||
"Attempt to prev(it, n) with a positive n on a non-bidirectional iterator");
|
||||
_VSTD::advance(__x, -__n);
|
||||
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _InputIter
|
||||
prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) {
|
||||
// Calling `advance` with a negative value on a non-bidirectional iterator is a no-op in the current implementation.
|
||||
// Note that this check duplicates the similar check in `std::advance`.
|
||||
_LIBCPP_ASSERT_PEDANTIC(__n <= 0 || __has_bidirectional_iterator_category<_InputIter>::value,
|
||||
"Attempt to prev(it, n) with a positive n on a non-bidirectional iterator");
|
||||
std::advance(__x, -__n);
|
||||
return __x;
|
||||
}
|
||||
|
||||
|
@ -43,15 +44,13 @@ namespace __prev {
|
|||
|
||||
struct __fn {
|
||||
template <bidirectional_iterator _Ip>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
constexpr _Ip operator()(_Ip __x) const {
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x) const {
|
||||
--__x;
|
||||
return __x;
|
||||
}
|
||||
|
||||
template <bidirectional_iterator _Ip>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const {
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __x, iter_difference_t<_Ip> __n) const {
|
||||
ranges::advance(__x, -__n);
|
||||
return __x;
|
||||
}
|
||||
|
@ -66,7 +65,7 @@ struct __fn {
|
|||
} // namespace __prev
|
||||
|
||||
inline namespace __cpo {
|
||||
inline constexpr auto prev = __prev::__fn{};
|
||||
inline constexpr auto prev = __prev::__fn{};
|
||||
} // namespace __cpo
|
||||
} // namespace ranges
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue