Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix indirect comparisons #489

Draft
wants to merge 1 commit into
base: dev-jbcoe-no-deferred-requirements
Choose a base branch
from
Draft
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
28 changes: 11 additions & 17 deletions DRAFT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ should not be considered in isolation.

* Add discussion of constraints and incomplete type support.

* TODO: Fix spec of `<=>`.
* Fix spec of `<=>` to use `synth-three-way-result`.

* Remove constraints on `operator==` and `operator<=>` for `indirect`.

## Changes in R11

Expand Down Expand Up @@ -867,12 +869,12 @@ class indirect {
template <class U, class AA>
friend constexpr auto operator<=>(
const indirect& lhs, const indirect<U, AA>& rhs) noexcept(see below)
-> compare_three_way_result_t<T, U>;
-> synth-three-way-result<T, U>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we had previously made this change in the LWG session in Tokyo. This is want we want.


template <class U>
friend constexpr auto operator<=>(
const indirect& lhs, const U& rhs) noexcept(see below)
-> compare_three_way_result_t<T, U>;
-> synth-three-way-result<T, U>;

private:
pointer p; // exposition only
Expand Down Expand Up @@ -1215,21 +1217,17 @@ constexpr bool operator==(const indirect& lhs, const indirect<U, AA>& rhs)
noexcept(noexcept(*lhs == *rhs));
```

1. _Constraints_: `*lhs == *rhs` is well-formed and its result is convertible to bool.

2. _Returns_: If `lhs` is valueless or `rhs` is valueless,\
1. _Returns_: If `lhs` is valueless or `rhs` is valueless,\
`lhs.valueless_after_move() == rhs.valueless_after_move()`; otherwise `*lhs == *rhs`.

```c++
template <class U, class AA>
constexpr synth-three-way-result<T> operator<=>(const indirect& lhs,
constexpr synth-three-way-result<T, U> operator<=>(const indirect& lhs,
const indirect<U, AA>& rhs)
noexcept(noexcept(synth-three-way(*lhs, *rhs)));
```

3. _Constraints_: `*lhs <=> *rhs` is well-formed.

4. _Returns_: If `lhs` is valueless or `rhs` is valueless,\
2. _Returns_: If `lhs` is valueless or `rhs` is valueless,\
`!lhs.valueless_after_move() <=> !rhs.valueless_after_move()`; otherwise\
`synth-three-way(*lhs, *rhs)`.

Expand All @@ -1241,20 +1239,16 @@ constexpr bool operator==(const indirect& lhs, const U& rhs)
noexcept(noexcept(*lhs == rhs));
```

1. _Constraints_: `*lhs == rhs` is well-formed.

2. _Returns_: If `lhs` is valueless, false; otherwise `*lhs == rhs`.
1. _Returns_: If `lhs` is valueless, false; otherwise `*lhs == rhs`.

```c++
template <class U>
constexpr synth-three-way-result<T> operator<=>(const indirect& lhs,
constexpr synth-three-way-result<T, U> operator<=>(const indirect& lhs,
const U& rhs)
noexcept(noexcept(synth-three-way(*lhs, rhs)));
```

3. _Constraints_: `*lhs <=> rhs` is well-formed.

4. _Returns_: If `rhs` is valueless, `false < true`; otherwise `synth-three-way(*lhs, rhs)`.
2. _Returns_: If `rhs` is valueless, `false < true`; otherwise `synth-three-way(*lhs, rhs)`.

### X.Y.10 Hash support [indirect.hash]

Expand Down
Loading