Skip to content

Commit e0f31ec

Browse files
authored
Update README.md
1 parent 881a1c3 commit e0f31ec

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ auto drawCircle ()
229229
}
230230
```
231231
232-
> [!NOTE]
233-
> `is<'trait'>` denotes a C++ concept
232+
`is<'trait'>` is a C++ concept provided by the library that checks the type without `const` or `volatile` modifiers and as a non-reference type (i.e. the result of `std::remove_cvref_t`).
233+
This makes it easier to use this concept for forwarding references.
234234
235235
### traits can have multiple behaviors
236236
@@ -397,7 +397,7 @@ struct Any final
397397
};
398398

399399
template <typename T, typename U>
400-
concept not_same_as = not std::same_as<T, U>;
400+
concept not_same_as = not std::same_as<std::remove_cvref_t<T>, U>; // sic! T might be deduced to a reference type
401401
```
402402
403403
On the other hand, with a constraint ...
@@ -419,6 +419,8 @@ struct Any
419419
> [!NOTE]
420420
> `is<'constraint'>` is equivalent to `is<trait{'constraint'}>`
421421
422+
This check will work even when value will be deduced as reference type.
423+
422424
#### constraints can be used to force strong(er) coupling
423425
424426
It may be advantageous to manage all implementations of a trait in a class hierarchy because, for example, the IDE supports inheritance particularly well.
@@ -678,7 +680,7 @@ constexpr auto get (impl_for<WithSummary, Tweet>)
678680
}
679681
```
680682

681-
> [!NOTE]
683+
> [!TIP]
682684
> The short syntax also works for multiple methods and lambda implementations.
683685
684686
We can now use the type in a function that requires both traits.
@@ -902,7 +904,7 @@ auto printName ()
902904
## Tips for use
903905
904906
Since traits are essentially used within `is<...>`, the trait names should be chosen appropriately to maintain a natural reading flow.
905-
For this reason, a noun is used in all examples or the paraphrase *with ... behavior* instead of *has ... behavior* is used.
907+
For this reason, a noun or the paraphrase *with ... behavior* instead of *has ... behavior* is used in all examples .
906908
907909
## Implementation notes
908910

0 commit comments

Comments
 (0)