Return of indicator to function
-
How can the index be returned to function from function?
void f0(char) {}
void (*)(char) f1() {return f0;} // В возвращаемом типе ошибка
May I announce
auto
I'm not interested.
-
The following ways can be used to re-enter the function.
(1) Clear indication of type.
void (*f1())(char) { return f0; }
(2) Synonym announcement through
typedef
♪typedef void (*TFunc)(char); TFunc f1() { return f0; }
(3) Synonym announcement through
using
(sighs)c++11
)using TFunc = void (*)(char); TFunc f1() { return f0; }
(4) Semi-automatic definition of re-entry type
c++11
)auto f1() -> decltype(&f0) { return f0; }
(5) Automatic definition of re-entry type (c)
c++14
)auto f1() { return f0; }