mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-03 19:22: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
65
third_party/libcxx/__algorithm/copy_n.h
vendored
65
third_party/libcxx/__algorithm/copy_n.h
vendored
|
@ -21,45 +21,38 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<class _InputIterator, class _Size, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename enable_if
|
||||
<
|
||||
__has_input_iterator_category<_InputIterator>::value &&
|
||||
!__has_random_access_iterator_category<_InputIterator>::value,
|
||||
_OutputIterator
|
||||
>::type
|
||||
copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
|
||||
{
|
||||
typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
|
||||
_IntegralSize __n = __orig_n;
|
||||
if (__n > 0)
|
||||
{
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
for (--__n; __n > 0; --__n)
|
||||
{
|
||||
++__first;
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
}
|
||||
template <class _InputIterator,
|
||||
class _Size,
|
||||
class _OutputIterator,
|
||||
__enable_if_t<__has_input_iterator_category<_InputIterator>::value &&
|
||||
!__has_random_access_iterator_category<_InputIterator>::value,
|
||||
int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
|
||||
copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) {
|
||||
typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
|
||||
_IntegralSize __n = __orig_n;
|
||||
if (__n > 0) {
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
for (--__n; __n > 0; --__n) {
|
||||
++__first;
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
template<class _InputIterator, class _Size, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
typename enable_if
|
||||
<
|
||||
__has_random_access_iterator_category<_InputIterator>::value,
|
||||
_OutputIterator
|
||||
>::type
|
||||
copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
|
||||
{
|
||||
typedef typename iterator_traits<_InputIterator>::difference_type difference_type;
|
||||
typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
|
||||
_IntegralSize __n = __orig_n;
|
||||
return _VSTD::copy(__first, __first + difference_type(__n), __result);
|
||||
template <class _InputIterator,
|
||||
class _Size,
|
||||
class _OutputIterator,
|
||||
__enable_if_t<__has_random_access_iterator_category<_InputIterator>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
|
||||
copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) {
|
||||
typedef typename iterator_traits<_InputIterator>::difference_type difference_type;
|
||||
typedef decltype(std::__convert_to_integral(__orig_n)) _IntegralSize;
|
||||
_IntegralSize __n = __orig_n;
|
||||
return std::copy(__first, __first + difference_type(__n), __result);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue