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
30
third_party/libcxx/__algorithm/clamp.h
vendored
30
third_party/libcxx/__algorithm/clamp.h
vendored
|
@ -20,24 +20,22 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
template<class _Tp, class _Compare>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
const _Tp&
|
||||
clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp)
|
||||
{
|
||||
_LIBCPP_ASSERT(!__comp(__hi, __lo), "Bad bounds passed to std::clamp");
|
||||
return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v;
|
||||
|
||||
template <class _Tp, class _Compare>
|
||||
[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
|
||||
clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
|
||||
_LIBCPP_LIFETIMEBOUND const _Tp& __lo,
|
||||
_LIBCPP_LIFETIMEBOUND const _Tp& __hi,
|
||||
_Compare __comp) {
|
||||
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__comp(__hi, __lo), "Bad bounds passed to std::clamp");
|
||||
return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v;
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
const _Tp&
|
||||
clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi)
|
||||
{
|
||||
return _VSTD::clamp(__v, __lo, __hi, __less<_Tp>());
|
||||
template <class _Tp>
|
||||
[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
|
||||
clamp(_LIBCPP_LIFETIMEBOUND const _Tp& __v,
|
||||
_LIBCPP_LIFETIMEBOUND const _Tp& __lo,
|
||||
_LIBCPP_LIFETIMEBOUND const _Tp& __hi) {
|
||||
return std::clamp(__v, __lo, __hi, __less<>());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue