Is there a way to write a requires requires
expression to apprehend that a template parameter is void?
I believe it is legal to make the value of std::is_void_v<ParmThree>
a parameter of the template. However, I cannot formulate a syntax to check this in a requirement - for being either true or false.
Is it possible? How would it be done?
CodePudding user response:
requires requires
works because the nested (second) requires
returns a bool.
Since you already have a bool, you can just do requires std::is_void_v<T>
:
template <typename T>
requires std::is_void_v<T>
struct A {};