You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constexpr void f(unsigned char *p, int n) {
if (std::is_constant_evaluated()) { // should not be a constexpr if statement
for (int k = 0; k<n; ++k) p[k] = 0;
} else {
memset(p, 0, n); // not a core constant expression
}
}
Should this say std::memset instead of memset to be more consistent with the rest of C++? There are a few other cases in which std:: is omitted for C standard functions.
This is being rather pedantic, because anyone reading the Standard would know what is meant by memset here.
The text was updated successfully, but these errors were encountered:
Given there's already if consteval, I think it would be better to show a brand new example which uses std::is_constant_evaluated in a ternary conditional expression.
[meta.const.eval] has this code example:
Should this say
std::memset
instead ofmemset
to be more consistent with the rest of C++? There are a few other cases in whichstd::
is omitted for C standard functions.This is being rather pedantic, because anyone reading the Standard would know what is meant by
memset
here.The text was updated successfully, but these errors were encountered: