I would like to declare a variable of type pointer to function returning pointer to function. Essentially what the following does, but without any typedef
s
You can have a look at the declaration of signal()
which is a function taking a void(*)()
and returning one of those. The variable ptr
can be declared like this:
void (*(*ptr)())()
The notation is a bit awkward and clearly inside out. It may be easier to use trailing return types:
auto (*ptr)() -> void (*)()
... or, of course, use trailing return types all the way through:
auto (*ptr)() -> auto (*)() -> void