mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-10-04 13:41:02 +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/__algorithm/unwrap_iter.h
vendored
23
third_party/libcxx/__algorithm/unwrap_iter.h
vendored
|
@ -13,7 +13,7 @@
|
|||
#include <__iterator/iterator_traits.h>
|
||||
#include <__memory/pointer_traits.h>
|
||||
#include <__type_traits/enable_if.h>
|
||||
#include <__type_traits/is_copy_constructible.h>
|
||||
#include <__type_traits/is_constructible.h>
|
||||
#include <__utility/declval.h>
|
||||
#include <__utility/move.h>
|
||||
|
||||
|
@ -21,12 +21,14 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// TODO: Change the name of __unwrap_iter_impl to something more appropriate
|
||||
// The job of __unwrap_iter is to remove iterator wrappers (like reverse_iterator or __wrap_iter),
|
||||
// to reduce the number of template instantiations and to enable pointer-based optimizations e.g. in std::copy.
|
||||
// In debug mode, we don't do this.
|
||||
//
|
||||
// Some algorithms (e.g. std::copy, but not std::sort) need to convert an
|
||||
// "unwrapped" result back into the original iterator type. Doing that is the job of __rewrap_iter.
|
||||
|
@ -38,7 +40,8 @@ struct __unwrap_iter_impl {
|
|||
static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __unwrap(_Iter __i) _NOEXCEPT { return __i; }
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_ENABLE_DEBUG_MODE
|
||||
// TODO(hardening): make sure that the following unwrapping doesn't unexpectedly turn hardened iterators into raw
|
||||
// pointers.
|
||||
|
||||
// It's a contiguous iterator, so we can use a raw pointer instead
|
||||
template <class _Iter>
|
||||
|
@ -54,13 +57,11 @@ struct __unwrap_iter_impl<_Iter, true> {
|
|||
}
|
||||
};
|
||||
|
||||
#endif // !_LIBCPP_ENABLE_DEBUG_MODE
|
||||
|
||||
template<class _Iter,
|
||||
class _Impl = __unwrap_iter_impl<_Iter>,
|
||||
__enable_if_t<is_copy_constructible<_Iter>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
|
||||
decltype(_Impl::__unwrap(std::declval<_Iter>())) __unwrap_iter(_Iter __i) _NOEXCEPT {
|
||||
template <class _Iter,
|
||||
class _Impl = __unwrap_iter_impl<_Iter>,
|
||||
__enable_if_t<is_copy_constructible<_Iter>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 decltype(_Impl::__unwrap(std::declval<_Iter>()))
|
||||
__unwrap_iter(_Iter __i) _NOEXCEPT {
|
||||
return _Impl::__unwrap(__i);
|
||||
}
|
||||
|
||||
|
@ -79,4 +80,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _OrigIter __rewrap_iter(_OrigIter __orig
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_UNWRAP_ITER_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue