0

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:
Jan Keitel
2025-05-02 07:51:58 -07:00
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>
```c++
template <typename T,
typename = std::enable_if_t<std::is_same_v<std::remove_cvref_t<T>,
int>>>
template <typename T>
requires (std::is_same_v<std::remove_cvref_t<T>, int>)
void foo(T t);
```