Reading cppreference's description of functional style cast, I stumbled upon the following explanation for void():
If target-type is (possibly cv-qualified) void, the expression is a void prvalue without a result object (since C++17)
Now I understand that I can create a void() prvalue like so, but what can I use it for and why is this even possible?
I suppose you refer to this paragraph
and the bullet
If you put the standardese language aside, its actually not that complicated. I suppose you wonder why one would write something like this:
According to the above this is valid, but not really useful. Now consider you have a function template like this:
Then you can instantiate it with a
Twhosevalue_typeisvoid:There is no object returned, but the type of the expression
T::value_typeinfoo<X>isvoid, the function hasvoidreturn type.