Skip to content
Open
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
2 changes: 1 addition & 1 deletion docs/spec/explicit_conversion_dispatch/accessor.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ struct accessor<P, D, T() cv ref noex> {

`(2)` When `sizeof...(Os)` is greater than `1`, and `accessor<P, D, Os>...` are default-constructible, inherits all `accessor<P, D, Os>...` types and `using` their `operator return-type-of<Os>`. `return-type-of<O>` denotes the *return type* of the overload type `O`.

`(3)` When `sizeof...(Os)` is `1` and the only type `O` in `Os` is `T() cv ref noex`, provides an explicit `operator T()` with the same *cv ref noex* specifiers. `accessor::operator T()` is equivalent to `return invoke<D, T() cv ref noex>(static_cast<P cv <ref ? ref : &>>(*this))`.
`(3)` When `sizeof...(Os)` is `1` and the only type `O` in `Os` is `T() cv ref noex`, provides an explicit `operator T()` with the same *cv ref noex* specifiers. `accessor::operator T()` is equivalent to `return invoke<D, T() cv ref noex>(static_cast<P cv <ref ? ref : &>>(*this))`.
2 changes: 1 addition & 1 deletion docs/spec/implicit_conversion_dispatch/accessor.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ struct accessor<P, D, T() cv ref noex> {

`(2)` When `sizeof...(Os)` is greater than `1`, and `accessor<P, D, Os>...` are default-constructible, inherits all `accessor<P, D, Os>...` types and `using` their `operator return-type-of<Os>`. `return-type-of<O>` denotes the *return type* of the overload type `O`.

`(3)` When `sizeof...(Os)` is `1` and the only type `O` in `Os` is `T() cv ref noex`, provides an implicit `operator T()` with the same *cv ref noex* specifiers. `accessor::operator T()` is equivalent to `return invoke<T() cv ref noex>(static_cast<P cv <ref ? ref : &>>(*this))`.
`(3)` When `sizeof...(Os)` is `1` and the only type `O` in `Os` is `T() cv ref noex`, provides an implicit `operator T()` with the same *cv ref noex* specifiers. `accessor::operator T()` is equivalent to `return invoke<D, T() cv ref noex>(static_cast<P cv <ref ? ref : &>>(*this))`.
2 changes: 1 addition & 1 deletion docs/spec/operator_dispatch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Let `self` be the operand of [`proxy`](../proxy/README.md), and `other` and `oth
| `operator_dispatch<"!", false>` | `!self` |
| `operator_dispatch<"&&", false>` | `self && other` |
| `operator_dispatch<"||", false>` | `self || other` |
| `operator_dispatch<"~", false>` | `!self` |
| `operator_dispatch<"~", false>` | `~self` |
| `operator_dispatch<"&", false>` | `&self`, `self & other` |
| `operator_dispatch<"|", false>` | `self | other` |
| `operator_dispatch<"^", false>` | `self ^ other` |
Expand Down
58 changes: 40 additions & 18 deletions docs/spec/operator_dispatch/accessor.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,56 +29,78 @@ When `Rhs` is `false`, the other specializations are defined as follows, where `

### Regular SOPs

When `Sign` is one of `"+"`, `"-"`, `"*"`, `"/"`, `"%"`, `"++"`, `"--"`, `"=="`, `"!="`, `">"`, `"<"`, `">="`, `"<="`, `"<=>"`, `"&&"`, `"||"`, `"&"`, `"|"`, `"^"`, `"<<"`, `">>"`, `","`, `"->*"`, `"()"`, `"[]"`,
When `Sign` is one of `"+"`, `"-"`, `"*"`, `"/"`, `"%"`, `"=="`, `"!="`, `">"`, `"<"`, `">="`, `"<="`, `"<=>"`, `"&&"`, `"||"`, `"&"`, `"|"`, `"^"`, `"<<"`, `">>"`, `","`, `"->*"`, `"()"`, `"[]"`,

```cpp
// (3)
template <class P, class D, class R, class... Args>
struct accessor<P, D, R(Args...) cv ref noex> {
R operator sop (Args... args) cv ref noex;
}
};
```

`(3)` Provides an `operator sop(Args...)` with the same *cv ref noex* specifiers as of the overload type. `accessor::operator sop(Args...)` is equivalent to `return invoke<D, R(Args...) cv ref noex>(static_cast<P cv <ref ? ref : &>>(*this), std::forward<Args>(args)...)`.

### `!` and `~`
### `"!"` and `"~"`

When `Sign` is either `!` and `~`,
When `Sign` is either `"!"` or `"~"`,

```cpp
// (4)
template <class P, class D, class R>
struct accessor<P, D, R() cv ref noex> {
R operator sop () cv ref noex;
}
};
```

`(4)` Provides an `operator sop()` with the same *cv ref noex* specifiers as of the overload type. `accessor::operator sop()` is equivalent to `return invoke<D, R() cv ref noex>(static_cast<P cv <ref ? ref : &>>(*this))`.

### `"++"` and `"--"`

When `Sign` is either `"++"` or `"--"`,

```cpp
// (5)
template <class P, class D, class R>
struct accessor<P, D, R() cv ref noex> {
/* see below */ operator sop () cv ref noex;
};

// (6)
template <class P, class D, class R>
struct accessor<P, D, R(int) cv ref noex> {
R operator sop (int) cv ref noex;
};
```

`(5)` Provides a prefix `operator sop()` with the same *cv ref noex* specifiers as of the overload type. `accessor::operator sop()` calls `invoke<D, R() cv ref noex>(static_cast<P cv <ref ? ref : &>>(*this))` and returns `static_cast<P cv <ref ? ref : &>>(*this)`.

`(6)` Provides a postfix `operator sop(int)` with the same *cv ref noex* specifiers as of the overload type. `accessor::operator sop(int)` is equivalent to `return invoke<D, R(int) cv ref noex>(static_cast<P cv <ref ? ref : &>>(*this), 0)`.

### Assignment SOPs

When `Sign` is one of `"+="`, `"-="`, `"*="`, `"/="`, `"%="`, `"&="`, `"|="`, `"^="`, `"<<="`, `">>="`,

```cpp
// (5)
// (7)
template <class P, class D, class R, class Arg>
struct accessor<P, D, R(Arg) cv ref noex> {
/* see below */ operator sop (Arg arg) cv ref noex;
}
};
```

`(4)` Provides an `operator sop(Arg)` with the same *cv ref noex* specifiers as of the overload type. `accessor::operator sop(Arg)` calls `invoke<D, R(Arg) cv ref noex>(static_cast<P cv <ref ? ref : &>>(*this), std::forward<Arg>(arg))` and returns `static_cast<P cv <ref ? ref : &>>(*this)`.
`(7)` Provides an `operator sop(Arg)` with the same *cv ref noex* specifiers as of the overload type. `accessor::operator sop(Arg)` calls `invoke<D, R(Arg) cv ref noex>(static_cast<P cv <ref ? ref : &>>(*this), std::forward<Arg>(arg))` and returns `static_cast<P cv <ref ? ref : &>>(*this)`.

## Right-Hand-Side Operand Specializations

```cpp
// (6)
// (8)
template <class P, class D, class... Os>
requires(sizeof...(Os) > 1u && (std::is_constructible_v<accessor<P, D, Os>> && ...))
struct accessor<P, D, Os...> : accessor<P, D, Os>... {};
```

`(6)` When `sizeof...(Os)` is greater than `1`, and `accessor<P, D, Os>...` are default-constructible types, inherits all `accessor<P, D, Os>...` types.
`(8)` When `sizeof...(Os)` is greater than `1`, and `accessor<P, D, Os>...` are default-constructible types, inherits all `accessor<P, D, Os>...` types.

When `Rhs` is `true`, the other specializations are defined as follows, where `sizeof...(Os)` is `1` and the only type `O` qualified with `cv ref noex`:

Expand All @@ -87,25 +109,25 @@ When `Rhs` is `true`, the other specializations are defined as follows, where `s
When `Sign` is one of `"+"`, `"-"`, `"*"`, `"/"`, `"%"`, `"=="`, `"!="`, `">"`, `"<"`, `">="`, `"<="`, `"<=>"`, `"&&"`, `"||"`, `"&"`, `"|"`, `"^"`, `"<<"`, `">>"`, `","`, `"->*"`,

```cpp
// (7)
// (9)
template <class P, class D, class R, class Arg>
struct accessor<P, D, R(Arg) cv ref noex> {
friend R operator sop (Arg arg, P cv <ref ? ref : &> self) noex;
}
};
```

`(7)` Provides a `friend operator sop(Arg arg, P cv <ref ? ref : &> self)` with the same *noex* specifiers as of the overload type. `accessor::operator sop(Arg arg, P cv <ref ? ref : &> self)` is equivalent to `return invoke<D, R(Arg) cv ref noex>(static_cast<P cv <ref ? ref : &>>(self), std::forward<Arg>(arg))`.
`(9)` Provides a `friend operator sop(Arg arg, P cv <ref ? ref : &> self)` with the same *noex* specifiers as of the overload type. `accessor::operator sop(Arg arg, P cv <ref ? ref : &> self)` is equivalent to `return invoke<D, R(Arg) cv ref noex>(static_cast<P cv <ref ? ref : &>>(self), std::forward<Arg>(arg))`.

### Assignment SOPs

When `Sign` is one of `"+="`, `"-="`, `"*="`, `"/="`, `"%="`, `"&="`, `"|="`, `"^="`, `"<<="`, `">>="`,

```cpp
// (8)
// (10)
template <class P, class D, class R, class Arg>
struct accessor<P, D, R(Arg) cv ref noex> {
friend /* see below */ operator sop (Arg arg, P cv <ref ? ref : &> self) noex;
}
struct accessor<P, D, R(Arg&) cv ref noex> {
friend Arg& operator sop (Arg& arg, P cv <ref ? ref : &> self) noex;
};
```

`(8)` Provides a `friend operator sop(Arg arg, P cv <ref ? ref : &> self)` with the same *noex* specifiers as of the overload type. `accessor::operator sop(Arg arg, P cv <ref ? ref : &> self)` calls `invoke<D, R(Arg) cv ref noex>(static_cast<P cv <ref ? ref : &>>(self), std::forward<Arg>(arg))` and returns `static_cast<P cv <ref ? ref : &>>(self)`.
`(10)` Provides a `friend operator sop(Arg& arg, P cv <ref ? ref : &> self)` with the same *noex* specifiers as of the overload type. `accessor::operator sop(Arg& arg, P cv <ref ? ref : &> self)` calls `invoke<D, R(Arg&) cv ref noex>(static_cast<P cv <ref ? ref : &>>(self), arg)` and returns `arg`.
Loading