Does std::remove_cvref replace std::decay after C++20?
From this link, I cannot understand what this means:
C++20 will have a new trait
std::remove_cvrefthat doesn't have undesirable effect ofstd::decayon arrays
What is the undesirable effect of std::decay?
Example and explanation, please!
std::remove_cvref does not replace std::decay. They are used for two different things.
An array naturally decays into a pointer to its first element. std::decay will decay an array type to a pointer type. So, for example, std::decay<const char[N]>::type is const char*.
Whereas std::remove_cvref removes const, volatile and & from a type without changing anything else about the type. So, for example, std::remove_cvref<const char[N]>::type is char[N] rather than char*.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With