Reputation: 20780
I've found this code in the project I'm working:
template<typename T>
class SomeClass
{
};
typedef SomeClass<void(void)> SomeType;
What means <void(void)>
construction? Can you please explain in a simple sample how a construction like this one may be used?
Upvotes: 3
Views: 312
Reputation: 20314
T
here is a type of function that returns nothing and takes no arguments.
Upvotes: 1
Reputation: 170055
It means that the type parameter is a function type (note, not a function pointer, but a function type) that takes no parameters, and returns no value.
You can even define function parameters in such a way:
void f (void(void));
That will decay to a function pointer when passed (just like an array parameter decays to a pointer).
Upvotes: 5