Use requires instead of SFINAE in style guide sample
This is just a minor change to a style guide example, as C++20 constraints are easier to read and give better error messages than SFINAE. Bug: 415007784 Change-Id: I8c00cb907120ada910b9ee106b366a3ca09a1b24 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6507222 Commit-Queue: Rick Byers <rbyers@chromium.org> Reviewed-by: Rick Byers <rbyers@chromium.org> Auto-Submit: Jan Keitel <jkeitel@google.com> Cr-Commit-Position: refs/heads/main@{#1454978}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
82f76011f5
commit
2bc3592b9a
@ -1309,9 +1309,8 @@ it's an implementation detail that the data is contiguous (e.g.
|
|||||||
### std::remove_cvref[_t] <sup>[allowed]</sup>
|
### std::remove_cvref[_t] <sup>[allowed]</sup>
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
template <typename T,
|
template <typename T>
|
||||||
typename = std::enable_if_t<std::is_same_v<std::remove_cvref_t<T>,
|
requires (std::is_same_v<std::remove_cvref_t<T>, int>)
|
||||||
int>>>
|
|
||||||
void foo(T t);
|
void foo(T t);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user