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?
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:
That will decay to a function pointer when passed (just like an array parameter decays to a pointer).