I am wondering why void()
is a prvalue of void
but void{}
does not exist...? See the following answer: https://stackoverflow.com/a/37708167/293195
For example in the context:
template<typename R>
R foo(){
return R{};
}
void (C++) If a pointer's type is void* , the pointer can point to any variable that's not declared with the const or volatile keyword. A void* pointer can't be dereferenced unless it's cast to another type. A void* pointer can be converted into any other type of data pointer.
Initializing a variable without a specified type with a function that doesn't return will infer the variable type to be void .
CWG 2351, resolved in June, has made void{}
legal.
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