Skip to content

Commit 4a7a0c1

Browse files
authored
Fix compound requirement code example (AnthonyCalandra#127)
1 parent 42a660a commit 4a7a0c1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

CPP20.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ g(baz{}); // PASS.
221221
```c++
222222
template <typename T>
223223
concept C = requires(T x) {
224-
{*x} -> typename T::inner; // the type of the expression `*x` is convertible to `T::inner`
224+
{*x} -> std::convertible_to<typename T::inner>; // the type of the expression `*x` is convertible to `T::inner`
225225
{x + 1} -> std::same_as<int>; // the expression `x + 1` satisfies `std::same_as<decltype((x + 1))>`
226-
{x * 1} -> T; // the type of the expression `x * 1` is convertible to `T`
226+
{x * 1} -> std::convertible_to<T>; // the type of the expression `x * 1` is convertible to `T`
227227
};
228228
```
229229
* **Nested requirements** - denoted by the `requires` keyword, specify additional constraints (such as those on local parameter arguments).

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,9 @@ g(baz{}); // PASS.
324324
```c++
325325
template <typename T>
326326
concept C = requires(T x) {
327-
{*x} -> typename T::inner; // the type of the expression `*x` is convertible to `T::inner`
327+
{*x} -> std::convertible_to<typename T::inner>; // the type of the expression `*x` is convertible to `T::inner`
328328
{x + 1} -> std::same_as<int>; // the expression `x + 1` satisfies `std::same_as<decltype((x + 1))>`
329-
{x * 1} -> T; // the type of the expression `x * 1` is convertible to `T`
329+
{x * 1} -> std::convertible_to<T>; // the type of the expression `x * 1` is convertible to `T`
330330
};
331331
```
332332
* **Nested requirements** - denoted by the `requires` keyword, specify additional constraints (such as those on local parameter arguments).

0 commit comments

Comments
 (0)