Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions stl/inc/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -887,12 +887,10 @@ _NODISCARD _CONSTEXPR20 bool is_permutation(_FwdIt1 _First1, _FwdIt1 _Last1, _Fw

#ifdef __cpp_lib_concepts
namespace ranges {
// clang-format off
template <class _It, class _Se>
concept _Bidi_common = is_same_v<_It, _Se> && bidirectional_iterator<_It>;
template <class _Rng>
concept _Bidi_common_range = common_range<_Rng> && bidirectional_iterator<iterator_t<_Rng>>;
// clang-format on

class _Is_permutation_fn : private _Not_quite_object {
public:
Expand Down Expand Up @@ -3913,16 +3911,14 @@ namespace ranges {
} // namespace ranges
#endif // __cpp_lib_concepts

// clang-format off
#ifdef __cpp_lib_concepts
template <class _InIt, class _OutIt>
concept _Can_reread_dest = forward_iterator<_OutIt> && same_as<iter_value_t<_InIt>, iter_value_t<_OutIt>>;
#else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv
template <class _InIt, class _OutIt>
_INLINE_VAR constexpr bool _Can_reread_dest =
_Is_fwd_iter_v<_OutIt> && is_same_v<_Iter_value_t<_InIt>, _Iter_value_t<_OutIt>>;
_INLINE_VAR constexpr bool _Can_reread_dest = _Is_fwd_iter_v<_OutIt> //
&& is_same_v<_Iter_value_t<_InIt>, _Iter_value_t<_OutIt>>;
#endif // __cpp_lib_concepts
// clang-format on

template <class _InIt, class _OutIt, class _Pr>
_CONSTEXPR20 _OutIt unique_copy(_InIt _First, _InIt _Last, _OutIt _Dest, _Pr _Pred) {
Expand Down Expand Up @@ -4010,15 +4006,14 @@ namespace ranges {
template <class _In, class _Out>
using unique_copy_result = in_out_result<_In, _Out>;

// clang-format off
template <class _It, class _Ty>
concept _Is_input_with_value_type = input_iterator<_It> && same_as<iter_value_t<_It>, _Ty>;

template <class _It, class _Out>
concept _Can_reread_or_store = forward_iterator<_It>
|| _Is_input_with_value_type<_Out, iter_value_t<_It>>
|| indirectly_copyable_storable<_It, _Out>;
// clang-format on
concept _Can_reread_or_store = forward_iterator<_It> //
|| _Is_input_with_value_type<_Out, iter_value_t<_It>> //
|| indirectly_copyable_storable<_It, _Out>;

class _Unique_copy_fn : private _Not_quite_object {
public:
using _Not_quite_object::_Not_quite_object;
Expand Down Expand Up @@ -7077,7 +7072,7 @@ namespace ranges {
"ranges::inplace_merge requires the range [first, middle) to be sorted");
_STL_VERIFY(_RANGES _Is_sorted_until_unchecked(_Mid, _Last, _Pred, _Proj) == _Last,
"ranges::inplace_merge requires the range [middle, last) to be sorted");
#endif //_ITERATOR_DEBUG_LEVEL == 2
#endif // _ITERATOR_DEBUG_LEVEL == 2

// Find first element in [_First, _Mid) that is greater than *_Mid
while (!_STD invoke(_Pred, _STD invoke(_Proj, *_Mid), _STD invoke(_Proj, *_First))) {
Expand Down Expand Up @@ -9412,13 +9407,11 @@ _NODISCARD constexpr _Ty(max)(initializer_list<_Ty> _Ilist) {

#ifdef __cpp_lib_concepts
namespace ranges {
// clang-format off
template <class _It>
concept _Prefer_iterator_copies = // When we have a choice, should we copy iterators or copy elements?
// pre: input_iterator<_It>
// pre: input_iterator<_It>
sizeof(_It) <= 2 * sizeof(iter_value_t<_It>)
&& (is_trivially_copyable_v<_It> || !is_trivially_copyable_v<iter_value_t<_It>>);
// clang-format on

class _Max_fn : private _Not_quite_object {
public:
Expand Down
8 changes: 3 additions & 5 deletions stl/inc/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -2137,20 +2137,18 @@ using _Choose_atomic_base_t = typename _Select<is_floating_point_v<_TVal>>::temp
#else // ^^^ _HAS_CXX20 // !_HAS_CXX20 vvv
template <class _TVal, class _Ty = _TVal>
using _Choose_atomic_base_t = _Choose_atomic_base2_t<_TVal, _Ty>;
#endif //_HAS_CXX20
#endif // _HAS_CXX20

template <class _Ty>
struct atomic : _Choose_atomic_base_t<_Ty> { // atomic value
private:
using _Base = _Choose_atomic_base_t<_Ty>;

public:
// clang-format off
static_assert(is_trivially_copyable_v<_Ty> && is_copy_constructible_v<_Ty> && is_move_constructible_v<_Ty>
&& is_copy_assignable_v<_Ty> && is_move_assignable_v<_Ty>,
static_assert(is_trivially_copyable_v<_Ty> && is_copy_constructible_v<_Ty> && is_move_constructible_v<_Ty> //
&& is_copy_assignable_v<_Ty> && is_move_assignable_v<_Ty>,
"atomic<T> requires T to be trivially copyable, copy constructible, move constructible, copy assignable, "
"and move assignable.");
// clang-format on

using value_type = _Ty;

Expand Down
16 changes: 4 additions & 12 deletions stl/inc/chrono
Original file line number Diff line number Diff line change
Expand Up @@ -2171,13 +2171,11 @@ namespace chrono {
duration<common_type_t<typename _Duration::rep, seconds::rep>, ratio<1, _Pow10(fractional_width)>>;

constexpr hh_mm_ss() noexcept : hh_mm_ss{_Duration::zero()} {}
// clang-format off
constexpr explicit hh_mm_ss(_Duration _Dur)
: _Is_neg{_Dur < _Duration::zero()},
: _Is_neg{_Dur < _Duration::zero()}, //
_Hours{_CHRONO duration_cast<_CHRONO hours>(_CHRONO abs(_Dur))},
_Mins{_CHRONO duration_cast<_CHRONO minutes>(_CHRONO abs(_Dur) - hours())},
_Secs{_CHRONO duration_cast<_CHRONO seconds>(_CHRONO abs(_Dur) - hours() - minutes())} {
// clang-format on
if constexpr (treat_as_floating_point_v<typename precision::rep>) {
_Sub_secs = _CHRONO abs(_Dur) - hours() - minutes() - seconds();
} else {
Expand Down Expand Up @@ -4012,10 +4010,8 @@ namespace chrono {
// std::days can't represent std::seconds, and duration<int, atto>::max() is ~9.2 seconds.
constexpr auto _Max_tick = static_cast<intmax_t>((numeric_limits<make_signed_t<_Rep1>>::max) ());

// clang-format off
return ratio_less_equal_v<_Period1, _Period2>
return ratio_less_equal_v<_Period1, _Period2> //
&& ratio_greater_equal_v<ratio<_Max_tick, _Period2::num>, ratio_divide<ratio<1>, _Period1>>;
// clang-format on
} else if (is_floating_point_v<_Rep1>) {
// With the smallest possible _Period1, ratio<1,INTMAX_MAX>, one day has a tick count of
// 86,400*INTMAX_MAX ~= 7.97e23. This is representable by float and double, so they can always represent
Expand Down Expand Up @@ -5222,12 +5218,10 @@ concept _Chrono_parse_spec_callbacks = _Parse_align_callbacks<_Ty, _CharT>
};
// clang-format on

// clang-format off
template <class _Ty>
concept _Has_ok = requires(_Ty _At) {
{ _At.ok() } -> same_as<bool>;
};
// clang-format on

// A chrono spec is either a type (with an optional modifier), OR a literal character, never both.
template <class _CharT>
Expand Down Expand Up @@ -6140,12 +6134,10 @@ namespace chrono {

template <class _Ty>
static void _Validate_specifiers(const _Chrono_spec<_CharT>& _Spec, const _Ty& _Val) {
// clang-format off
if constexpr (_Is_specialization_v<_Ty, duration> || is_same_v<_Ty, sys_info>
|| _Is_specialization_v<_Ty, time_point> || _Is_specialization_v<_Ty, _Local_time_format_t>) {
if constexpr (_Is_specialization_v<_Ty, duration> || is_same_v<_Ty, sys_info> //
|| _Is_specialization_v<_Ty, time_point> || _Is_specialization_v<_Ty, _Local_time_format_t>) {
return;
}
// clang-format on

if constexpr (_Is_specialization_v<_Ty, hh_mm_ss>) {
if (_Spec._Type == 'H' && _Val.hours() >= hours{24}) {
Expand Down
12 changes: 4 additions & 8 deletions stl/inc/compare
Original file line number Diff line number Diff line change
Expand Up @@ -653,13 +653,11 @@ inline namespace _Cpos {
inline constexpr _Partial_order::_Cpo partial_order;
}

// clang-format off
template <class _Ty1, class _Ty2>
concept _Can_fallback_eq_lt = requires(_Ty1& _Left, _Ty2& _Right) {
{ _Left == _Right } -> _Implicitly_convertible_to<bool>;
{ _Left < _Right } -> _Implicitly_convertible_to<bool>;
{ _Left < _Right } -> _Implicitly_convertible_to<bool>;
};
// clang-format on

namespace _Compare_strong_order_fallback {
template <class _Ty1, class _Ty2>
Expand Down Expand Up @@ -775,14 +773,12 @@ namespace _Compare_partial_order_fallback {
_STD partial_order(_Left, _Right);
};

// clang-format off
template <class _Ty1, class _Ty2>
concept _Can_fallback_eq_lt_twice = requires(_Ty1& _Left, _Ty2& _Right) {
{ _Left == _Right } -> _Implicitly_convertible_to<bool>;
{ _Left < _Right } -> _Implicitly_convertible_to<bool>;
{ _Right < _Left } -> _Implicitly_convertible_to<bool>;
{ _Left == _Right } -> _Implicitly_convertible_to<bool>;
{ _Left < _Right } -> _Implicitly_convertible_to<bool>;
{ _Right < _Left } -> _Implicitly_convertible_to<bool>;
};
// clang-format on

class _Cpo {
private:
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/cvt/euc_0208
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ namespace stdext {
_Elem* _Mid2;
_Elem _Ch;

switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1,
_Mid2)) { // test result of single wide-char conversion
// test result of single wide-char conversion
switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1, _Mid2)) {
case _Mybase::noconv:
return static_cast<int>(_Wchars + (_Last1 - _First1));

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/cvt/jis_0208
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ namespace stdext {
_Elem* _Mid2;
_Elem _Ch;

switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1,
_Mid2)) { // test result of single wide-char conversion
// test result of single wide-char conversion
switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1, _Mid2)) {
case _Mybase::noconv:
return static_cast<int>(_Wchars + (_Last1 - _First1));

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/cvt/one_one
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ namespace stdext {
_Elem* _Mid2;
_Elem _Ch;

switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1,
_Mid2)) { // test result of single wide-char conversion
// test result of single wide-char conversion
switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1, _Mid2)) {
case _Mybase::noconv:
return static_cast<int>(_Wchars + (_Last1 - _First1));

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/cvt/sjis_0208
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ namespace stdext {
_Elem* _Mid2;
_Elem _Ch;

switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1,
_Mid2)) { // test result of single wide-char conversion
// test result of single wide-char conversion
switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1, _Mid2)) {
case _Mybase::noconv:
return static_cast<int>(_Wchars + (_Last1 - _First1));

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/cvt/utf16
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ namespace stdext {
_Elem* _Mid2;
_Elem _Ch;

switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1,
_Mid2)) { // test result of single wide-char conversion
// test result of single wide-char conversion
switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1, _Mid2)) {
case _Mybase::noconv:
return static_cast<int>(_Wchars + (_Last1 - _First1));

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/cvt/utf8
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ namespace stdext {
_Elem* _Mid2;
_Elem _Ch;

switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1,
_Mid2)) { // test result of single wide-char conversion
// test result of single wide-char conversion
switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1, _Mid2)) {
case _Mybase::noconv:
return static_cast<int>(_Wchars + (_Last1 - _First1));

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/cvt/utf8_utf16
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ namespace stdext {
_Elem* _Mid2;
_Elem _Ch;

switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1,
_Mid2)) { // test result of single wide-char conversion
// test result of single wide-char conversion
switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1, _Mid2)) {
case _Mybase::noconv:
return static_cast<int>(_Wchars + (_Last1 - _First1));

Expand Down
14 changes: 8 additions & 6 deletions stl/inc/cvt/wbuffer
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ namespace stdext {

char* _Buf = &_Str[0];
char* _Dest;
switch (
_Pcvt->unshift(_State, _Buf, _Buf + _Str.size(), _Dest)) { // test result of homing conversion

// test result of homing conversion
switch (_Pcvt->unshift(_State, _Buf, _Buf + _Str.size(), _Dest)) {
case _Codecvt::ok:
_Status = _Unused; // homed successfully

Expand Down Expand Up @@ -143,8 +144,9 @@ namespace stdext {
char* _Buf = &_Str[0];
const _Elem* _Src;
char* _Dest;
switch (_Pcvt->out(_State, &_Ch, &_Ch + 1, _Src, _Buf, _Buf + _Str.size(),
_Dest)) { // test result of converting one element

// test result of converting one element
switch (_Pcvt->out(_State, &_Ch, &_Ch + 1, _Src, _Buf, _Buf + _Str.size(), _Dest)) {
case _Codecvt::partial:
case _Codecvt::ok:
{ // converted something, try to put it out
Expand Down Expand Up @@ -274,8 +276,8 @@ namespace stdext {
}
}

switch (_Pcvt->in(_State, _Buf, _Buf + _Str.size(), _Src, &_Ch, &_Ch + 1,
_Dest)) { // test result of converting one element
// test result of converting one element
switch (_Pcvt->in(_State, _Buf, _Buf + _Str.size(), _Src, &_Ch, &_Ch + 1, _Dest)) {
case _Codecvt::partial:
case _Codecvt::ok:
_Str.erase(0, static_cast<size_t>(_Src - _Buf)); // discard any used input
Expand Down
8 changes: 4 additions & 4 deletions stl/inc/cvt/wstring
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ namespace stdext {
_Elem* _Dest = &_Wbuf[0];
_Elem* _Dnext;

switch (_Pcvt->in(_State, _First, _Last, _First, _Dest, _Dest + _Wbuf.size(),
_Dnext)) { // test result of converting one or more bytes
// test result of converting one or more bytes
switch (_Pcvt->in(_State, _First, _Last, _First, _Dest, _Dest + _Wbuf.size(), _Dnext)) {
case _Codecvt::partial:
case _Codecvt::ok:
if (_Dest < _Dnext) {
Expand Down Expand Up @@ -173,8 +173,8 @@ namespace stdext {
char* _Dest = &_Bbuf[0];
char* _Dnext;

switch (_Pcvt->out(_State, _First, _Last, _First, _Dest, _Dest + _Bbuf.size(),
_Dnext)) { // test result of converting one or more wide chars
// test result of converting one or more wide chars
switch (_Pcvt->out(_State, _First, _Last, _First, _Dest, _Dest + _Bbuf.size(), _Dnext)) {
case _Codecvt::partial:
case _Codecvt::ok:
if (_Dest < _Dnext) {
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/cvt/xjis
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ namespace stdext {
_Elem* _Mid2;
_Elem _Ch;

switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1,
_Mid2)) { // test result of single wide-char conversion
// test result of single wide-char conversion
switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1, _Mid2)) {
case _Mybase::noconv:
return static_cast<int>(_Wchars + (_Last1 - _First1));

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/cvt/xtwo_byte
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ namespace stdext {
_Elem* _Mid2;
_Elem _Ch;

switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1,
_Mid2)) { // test result of single wide-char conversion
// test result of single wide-char conversion
switch (do_in(_Mystate, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1, _Mid2)) {
case _Mybase::noconv:
return static_cast<int>(_Wchars + (_Last1 - _First1));

Expand Down
10 changes: 6 additions & 4 deletions stl/inc/fstream
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,9 @@ protected:
const _Elem _Ch = _Traits::to_char_type(_Meta);
const _Elem* _Src;
char* _Dest;
switch (_Pcvt->out(_State, &_Ch, &_Ch + 1, _Src, _Str, _Str + _Codecvt_temp_buf,
_Dest)) { // test result of converting one element

// test result of converting one element
switch (_Pcvt->out(_State, &_Ch, &_Ch + 1, _Src, _Str, _Str + _Codecvt_temp_buf, _Dest)) {
case codecvt_base::partial:
case codecvt_base::ok:
{ // converted something, try to put it out
Expand Down Expand Up @@ -526,8 +527,9 @@ protected:

_Elem _Ch;
_Elem* _Dest;
switch (_Pcvt->in(_State, _Str.data(), _Str.data() + _Str.size(), _Src, &_Ch, &_Ch + 1,
_Dest)) { // test result of converting one element

// test result of converting one element
switch (_Pcvt->in(_State, _Str.data(), _Str.data() + _Str.size(), _Src, &_Ch, &_Ch + 1, _Dest)) {
case codecvt_base::partial:
case codecvt_base::ok:
if (_Dest != &_Ch) { // got an element, put back excess and deliver it
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/memory
Original file line number Diff line number Diff line change
Expand Up @@ -4056,12 +4056,12 @@ public:
template <class _Ty>
struct _Pointer_of_helper {};

// clang-format off
template <_Has_member_pointer _Ty>
struct _Pointer_of_helper<_Ty> {
using type = typename _Ty::pointer;
};

// clang-format off
template <_Has_member_element_type _Ty>
requires (!_Has_member_pointer<_Ty>)
struct _Pointer_of_helper<_Ty> {
Expand Down
Loading