Skip to content
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
de04d41
Merge pull request #1064 from microsoft/master
StephanTLavavej Jul 21, 2020
889b8c8
feature/spaceship: Clause 22: Containers (#1046)
ahanamuk Jul 28, 2020
63db7c6
Merge branch 'master' into update_spaceship
StephanTLavavej Aug 9, 2020
a1e96f2
Merge pull request #1178 from StephanTLavavej/update_spaceship
StephanTLavavej Aug 10, 2020
98c4f96
Merge pull request #1188 from microsoft/master
StephanTLavavej Aug 12, 2020
fa344bf
feature/spaceship: Clause 30: Regex (#1145)
cbezault Aug 20, 2020
b9642bf
Merge pull request #1212 from microsoft/master
StephanTLavavej Aug 20, 2020
183945e
Merge pull request #1236 from microsoft/master
Aug 27, 2020
f0eb010
feature/spaceship: Clause 19: Diagnostics (#1180)
cbezault Sep 3, 2020
fcbba69
Merge pull request #1298 from microsoft/master
StephanTLavavej Sep 16, 2020
de8ef2e
Merge pull request #1360 from microsoft/master
CaseyCarter Oct 9, 2020
dc62c36
Merge pull request #1380 from microsoft/master
CaseyCarter Oct 17, 2020
98ad286
Merge branch 'master' into feature/spaceship
StephanTLavavej Oct 27, 2020
24fbe3b
Merge pull request #1404 from StephanTLavavej/merge_spaceship
StephanTLavavej Oct 27, 2020
1d0c238
Merge pull request #1470 from microsoft/master
StephanTLavavej Nov 14, 2020
96ac4ff
Merge branch 'master' into merge_spaceship
StephanTLavavej Dec 10, 2020
939b933
Merge pull request #1526 from StephanTLavavej/merge_spaceship
StephanTLavavej Dec 11, 2020
8d2841f
Merge pull request #1537 from microsoft/master
StephanTLavavej Dec 17, 2020
92bd4b9
Merge branch 'master' into merge_spaceship
StephanTLavavej Jan 22, 2021
8285558
`if constexpr` is always available now.
StephanTLavavej Jan 22, 2021
0f71986
Merge pull request #1580 from StephanTLavavej/merge_spaceship
StephanTLavavej Jan 22, 2021
091958d
feature/spaceship: Clause 32: Thread support (#1590)
statementreply Jan 28, 2021
05a1c4f
Merge branch 'main' into merge_spaceship
StephanTLavavej Feb 3, 2021
b9ef974
Merge pull request #1615 from StephanTLavavej/merge_spaceship
StephanTLavavej Feb 3, 2021
e68b14a
feature/spaceship: Clause 28: Localization, Clause 29: Input/output (…
statementreply Feb 3, 2021
5443c4a
feature/spaceship: Clause 26: Numerics (#1627)
Feb 12, 2021
3c1da29
Merge branch 'main' into merge_spaceship
StephanTLavavej Feb 13, 2021
f27eaed
Merge pull request #1644 from StephanTLavavej/merge_spaceship
StephanTLavavej Feb 13, 2021
31a5d70
Merge branch 'main' into feature/spaceship
CaseyCarter Feb 17, 2021
ad6688c
Merge pull request #1655 from CaseyCarter/feature/spaceship
CaseyCarter Feb 17, 2021
250aa73
feature/spaceship: Clause 23: Iterators (#1645)
StephanTLavavej Feb 18, 2021
bbedd7a
feature/spaceship: Clause 21: Strings (#1635)
Feb 18, 2021
55c2af9
feature/spaceship: Clause 20: variant, monostate (#1657)
d-winsor Feb 19, 2021
eeed690
feature/spaceship: Clause 22: Container Iterators (#1648)
miscco Feb 19, 2021
88feca8
feature/spaceship: Clause 20: various synthesized equality operators …
d-winsor Feb 19, 2021
aad4417
feature/spaceship: Clause 20: bitset, charconv, and typeindex (#1660)
AnjuDel Feb 20, 2021
aca45f6
Merge branch 'main' into merge_spaceship
StephanTLavavej Feb 20, 2021
467780d
Merge pull request #1669 from StephanTLavavej/merge_spaceship
StephanTLavavej Feb 22, 2021
d22f916
feature/spaceship: Clause 20: unique_ptr/shared_ptr (#1666)
d-winsor Feb 22, 2021
0bed9f5
feature/spaceship: Clause 17: Feature-test macro, yvals_core.h commen…
StephanTLavavej Feb 22, 2021
5547f0f
feature/spaceship: Clause 20: pair, tuple, optional (#1206)
cbezault Feb 22, 2021
1bcfc8d
Fix take_view::sentinel, [range.take.sentinel].
StephanTLavavej Feb 22, 2021
415b7aa
Make __cpp_lib_concepts preprocessor comments more consistent.
StephanTLavavej Feb 24, 2021
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
40 changes: 39 additions & 1 deletion stl/inc/array
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ public:
return _Ptr == _Right._Ptr;
}

#if _HAS_CXX20
_NODISCARD constexpr strong_ordering operator<=>(const _Array_const_iterator& _Right) const noexcept {
return _Ptr <=> _Right._Ptr;
}
#else // ^^^ _HAS_CXX20 ^^^ / vvv !_HAS_CXX20 vvv
_NODISCARD _CONSTEXPR17 bool operator!=(const _Array_const_iterator& _Right) const noexcept {
return !(*this == _Right);
}
Expand All @@ -130,6 +135,7 @@ public:
_NODISCARD _CONSTEXPR17 bool operator>=(const _Array_const_iterator& _Right) const noexcept {
return !(*this < _Right);
}
#endif // !_HAS_CXX20

using _Prevent_inheriting_unwrap = _Array_const_iterator;

Expand Down Expand Up @@ -235,6 +241,12 @@ private:
return _Idx == _Right._Idx;
}

#if _HAS_CXX20
_NODISCARD constexpr strong_ordering operator<=>(const _Array_const_iterator& _Right) const noexcept {
_Compat(_Right);
return _Idx <=> _Right._Idx;
}
#else // ^^^ _HAS_CXX20 ^^^ / vvv !_HAS_CXX20 vvv
_NODISCARD _CONSTEXPR17 bool operator!=(const _Array_const_iterator& _Right) const noexcept {
return !(*this == _Right);
}
Expand All @@ -255,6 +267,7 @@ private:
_NODISCARD _CONSTEXPR17 bool operator>=(const _Array_const_iterator& _Right) const noexcept {
return !(*this < _Right);
}
#endif // !_HAS_CXX20

_CONSTEXPR17 void _Compat(const _Array_const_iterator& _Right) const noexcept { // test for compatible iterator pair
_STL_VERIFY(_Ptr == _Right._Ptr, "array iterators incompatible");
Expand Down Expand Up @@ -775,17 +788,41 @@ _CONSTEXPR20 void swap(array<_Ty, _Size>& _Left, array<_Ty, _Size>& _Right) noex

template <class _Ty, size_t _Size>
_NODISCARD _CONSTEXPR20 bool operator==(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) {
#ifdef __EDG__ // TRANSITION, VSO-1161663
return _STD equal(_Left.begin(), _Left.end(), _Right.begin());
#else // ^^^ workaround / no workaround vvv
return _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin());
#endif // ^^^ no workaround ^^^
}

#if !_HAS_CXX20
template <class _Ty, size_t _Size>
_NODISCARD _CONSTEXPR20 bool operator!=(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) {
_NODISCARD bool operator!=(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) {
return !(_Left == _Right);
}
#endif // !_HAS_CXX20

#ifdef __cpp_lib_concepts
template <class _Ty, size_t _Size>
_NODISCARD constexpr _Synth_three_way_result<_Ty> operator<=>(
const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) {
#ifdef __EDG__ // TRANSITION, VSO-1161663
return _STD lexicographical_compare_three_way(
_Left.begin(), _Left.end(), _Right.begin(), _Right.end(), _Synth_three_way{});
#else // ^^^ workaround / no workaround vvv
return _STD lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end(),
_Right._Unchecked_begin(), _Right._Unchecked_end(), _Synth_three_way{});
#endif // ^^^ no workaround ^^^
}
#else // __cpp_lib_concepts
template <class _Ty, size_t _Size>
_NODISCARD _CONSTEXPR20 bool operator<(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) {
#ifdef __EDG__ // TRANSITION, VSO-1161663
return _STD lexicographical_compare(_Left.begin(), _Left.end(), _Right.begin(), _Right.end());
#else // ^^^ workaround / no workaround vvv
return _STD lexicographical_compare(
_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin(), _Right._Unchecked_end());
#endif // ^^^ no workaround ^^^
}

template <class _Ty, size_t _Size>
Expand All @@ -802,6 +839,7 @@ template <class _Ty, size_t _Size>
_NODISCARD _CONSTEXPR20 bool operator>=(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) {
return !(_Left < _Right);
}
#endif // __cpp_lib_concepts

#if _HAS_CXX20
// FUNCTION TEMPLATE to_array
Expand Down
2 changes: 2 additions & 0 deletions stl/inc/bitset
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,11 @@ public:
return _CSTD memcmp(&_Array[0], &_Right._Array[0], sizeof(_Array)) == 0;
}

#if !_HAS_CXX20
_NODISCARD bool operator!=(const bitset& _Right) const noexcept {
return !(*this == _Right);
}
#endif // !_HAS_CXX20

_NODISCARD bool test(size_t _Pos) const {
if (_Bits <= _Pos) {
Expand Down
3 changes: 3 additions & 0 deletions stl/inc/charconv
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ to_chars_result to_chars(char* _First, char* _Last, bool _Value, int _Base = 10)
struct from_chars_result {
const char* ptr;
errc ec;
#if _HAS_CXX20
_NODISCARD friend bool operator==(const from_chars_result&, const from_chars_result&) = default;
#endif // _HAS_CXX20
};

// FUNCTION from_chars (STRING TO INTEGER)
Expand Down
29 changes: 29 additions & 0 deletions stl/inc/compare
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,35 @@ struct compare_three_way {
};
// clang-format on

// STRUCT _Synth_three_way
struct _Synth_three_way {
// clang-format off
template <class _Ty1, class _Ty2>
_NODISCARD constexpr auto operator()(const _Ty1& _Left, const _Ty2& _Right) const
requires requires {
{ _Left < _Right } -> _Boolean_testable;
{ _Right < _Left } -> _Boolean_testable;
}
// clang-format on
{
if constexpr (three_way_comparable_with<_Ty1, _Ty2>) {
return _Left <=> _Right;
} else {
if (_Left < _Right) {
return weak_ordering::less;
} else if (_Right < _Left) {
return weak_ordering::greater;
} else {
return weak_ordering::equivalent;
}
}
}
};

// ALIAS TEMPLATE _Synth_three_way_result
template <class _Ty1, class _Ty2 = _Ty1>
using _Synth_three_way_result = decltype(_Synth_three_way{}(_STD declval<_Ty1&>(), _STD declval<_Ty2&>()));

// Note: The following CPOs are passing arguments as lvalues; see GH-1374.

// CUSTOMIZATION POINT OBJECT strong_order
Expand Down
4 changes: 4 additions & 0 deletions stl/inc/complex
Original file line number Diff line number Diff line change
Expand Up @@ -1514,12 +1514,15 @@ _NODISCARD constexpr bool operator==(const complex<_Ty>& _Left, const _Ty& _Righ
return _Left.real() == _Right && _Left.imag() == 0;
}

#if !_HAS_CXX20
template <class _Ty>
_NODISCARD constexpr bool operator==(const _Ty& _Left, const complex<_Ty>& _Right) {
return _Left == _Right.real() && 0 == _Right.imag();
}
#endif // !_HAS_CXX20

// FUNCTION TEMPLATE operator!=
#if !_HAS_CXX20
template <class _Ty>
_NODISCARD constexpr bool operator!=(const complex<_Ty>& _Left, const complex<_Ty>& _Right) {
return !(_Left == _Right);
Expand All @@ -1534,6 +1537,7 @@ template <class _Ty>
_NODISCARD constexpr bool operator!=(const _Ty& _Left, const complex<_Ty>& _Right) {
return !(_Left == _Right);
}
#endif // !_HAS_CXX20

// FUNCTION TEMPLATE imag
template <class _Ty>
Expand Down
23 changes: 23 additions & 0 deletions stl/inc/deque
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ public:
return _Myoff == _Right._Myoff;
}

#if _HAS_CXX20
_NODISCARD strong_ordering operator<=>(const _Deque_unchecked_const_iterator& _Right) const noexcept {
return _Myoff <=> _Right._Myoff;
}
#else // ^^^ _HAS_CXX20 ^^^ / vvv !_HAS_CXX20 vvv
_NODISCARD bool operator!=(const _Deque_unchecked_const_iterator& _Right) const noexcept {
return !(*this == _Right);
}
Expand All @@ -126,6 +131,7 @@ public:
_NODISCARD bool operator>=(const _Deque_unchecked_const_iterator& _Right) const noexcept {
return !(*this < _Right);
}
#endif // !_HAS_CXX20

const _Container_base12* _Getcont() const noexcept { // get container pointer
return _Mycont;
Expand Down Expand Up @@ -345,6 +351,12 @@ public:
return this->_Myoff == _Right._Myoff;
}

#if _HAS_CXX20
_NODISCARD strong_ordering operator<=>(const _Deque_const_iterator& _Right) const noexcept {
_Compat(_Right);
return this->_Myoff <=> _Right._Myoff;
}
#else // ^^^ _HAS_CXX20 ^^^ / vvv !_HAS_CXX20 vvv
_NODISCARD bool operator!=(const _Deque_const_iterator& _Right) const noexcept {
return !(*this == _Right);
}
Expand All @@ -365,6 +377,7 @@ public:
_NODISCARD bool operator>=(const _Deque_const_iterator& _Right) const noexcept {
return !(*this < _Right);
}
#endif // !_HAS_CXX20

void _Compat(const _Deque_const_iterator& _Right) const noexcept { // test for compatible iterator pair
#if _ITERATOR_DEBUG_LEVEL == 0
Expand Down Expand Up @@ -1582,11 +1595,20 @@ _NODISCARD bool operator==(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Al
&& _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin());
}

#if !_HAS_CXX20
template <class _Ty, class _Alloc>
_NODISCARD bool operator!=(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Alloc>& _Right) {
return !(_Left == _Right);
}
#endif // !_HAS_CXX20

#ifdef __cpp_lib_concepts
template <class _Ty, class _Alloc>
_NODISCARD _Synth_three_way_result<_Ty> operator<=>(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Alloc>& _Right) {
return _STD lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end(),
_Right._Unchecked_begin(), _Right._Unchecked_end(), _Synth_three_way{});
}
#else // __cpp_lib_concepts
template <class _Ty, class _Alloc>
_NODISCARD bool operator<(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Alloc>& _Right) {
return _STD lexicographical_compare(
Expand All @@ -1607,6 +1629,7 @@ template <class _Ty, class _Alloc>
_NODISCARD bool operator>=(const deque<_Ty, _Alloc>& _Left, const deque<_Ty, _Alloc>& _Right) {
return !(_Left < _Right);
}
#endif // __cpp_lib_concepts

#if _HAS_CXX20
template <class _Ty, class _Alloc, class _Uty>
Expand Down
40 changes: 36 additions & 4 deletions stl/inc/filesystem
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
#include <xfilesystem_abi.h>
#include <xstring>

#if _HAS_CXX20
#include <compare>
#endif // _HAS_CXX20

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
#pragma warning(disable : _STL_DISABLED_WARNINGS)
Expand Down Expand Up @@ -1399,6 +1403,11 @@ namespace filesystem {
return _Left.compare(_Right) == 0;
}

#if _HAS_CXX20
_NODISCARD friend strong_ordering operator<=>(const path& _Left, const path& _Right) noexcept {
return _Left.compare(_Right) <=> 0;
}
#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv
_NODISCARD friend bool operator!=(const path& _Left, const path& _Right) noexcept {
return _Left.compare(_Right) != 0;
}
Expand All @@ -1418,6 +1427,7 @@ namespace filesystem {
_NODISCARD friend bool operator>=(const path& _Left, const path& _Right) noexcept {
return _Left.compare(_Right) >= 0;
}
#endif // !_HAS_CXX20

_NODISCARD friend path operator/(const path& _Left, const path& _Right) { // append a pair of paths together
return path(_Left) /= _Right;
Expand Down Expand Up @@ -1593,9 +1603,11 @@ namespace filesystem {
return _Lhs._Position == _Rhs._Position;
}

#if !_HAS_CXX20
_NODISCARD friend bool operator!=(const _Path_iterator& _Lhs, const _Path_iterator& _Rhs) {
return _Lhs._Position != _Rhs._Position;
}
#endif // !_HAS_CXX20

#if _ITERATOR_DEBUG_LEVEL != 0
friend void _Verify_range(const _Path_iterator& _Lhs, const _Path_iterator& _Rhs) {
Expand Down Expand Up @@ -1967,6 +1979,12 @@ namespace filesystem {
return _Myperms;
}

#if _HAS_CXX20
_NODISCARD friend bool operator==(const file_status& _Lhs, const file_status& _Rhs) noexcept {
return _Lhs._Myftype == _Rhs._Myftype && _Lhs._Myperms == _Rhs._Myperms;
}
#endif // _HAS_CXX20

void _Refresh(const __std_win_error _Error, const __std_fs_stats& _Stats) noexcept {
if (_Error == __std_win_error::_Success) {
const auto _Attrs = _Stats._Attributes;
Expand Down Expand Up @@ -2445,18 +2463,23 @@ namespace filesystem {
return _Result._Status;
}

_NODISCARD bool operator<(const directory_entry& _Rhs) const noexcept {
return _Path < _Rhs._Path;
}

_NODISCARD bool operator==(const directory_entry& _Rhs) const noexcept {
return _Path == _Rhs._Path;
}

#if _HAS_CXX20
_NODISCARD strong_ordering operator<=>(const directory_entry& _Rhs) const noexcept {
return _Path <=> _Rhs._Path;
}
#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv
_NODISCARD bool operator!=(const directory_entry& _Rhs) const noexcept {
return _Path != _Rhs._Path;
}

_NODISCARD bool operator<(const directory_entry& _Rhs) const noexcept {
return _Path < _Rhs._Path;
}

_NODISCARD bool operator<=(const directory_entry& _Rhs) const noexcept {
return _Path <= _Rhs._Path;
}
Expand All @@ -2468,6 +2491,7 @@ namespace filesystem {
_NODISCARD bool operator>=(const directory_entry& _Rhs) const noexcept {
return _Path >= _Rhs._Path;
}
#endif // !_HAS_CXX20

// [fs.dir.entry.io], inserter
template <class _Elem, class _Traits>
Expand Down Expand Up @@ -2706,9 +2730,11 @@ namespace filesystem {
return _Impl == _Rhs._Impl;
}

#if !_HAS_CXX20
_NODISCARD bool operator!=(const directory_iterator& _Rhs) const noexcept /* strengthened */ {
return _Impl != _Rhs._Impl;
}
#endif // !_HAS_CXX20

_Directory_entry_proxy operator++(int) {
_Directory_entry_proxy _Proxy(**this);
Expand Down Expand Up @@ -2955,9 +2981,11 @@ namespace filesystem {
return _Impl == _Rhs._Impl;
}

#if !_HAS_CXX20
_NODISCARD bool operator!=(const recursive_directory_iterator& _Rhs) const noexcept {
return _Impl != _Rhs._Impl;
}
#endif // !_HAS_CXX20

_Directory_entry_proxy operator++(int) {
_Directory_entry_proxy _Proxy(**this);
Expand Down Expand Up @@ -3649,6 +3677,10 @@ namespace filesystem {
uintmax_t capacity;
uintmax_t free;
uintmax_t available;

#if _HAS_CXX20
_NODISCARD friend constexpr bool operator==(const space_info&, const space_info&) noexcept = default;
#endif // _HAS_CXX20
};

_NODISCARD inline space_info space(const path& _Target) {
Expand Down
Loading