I'm trying to alias the std::function
type because I plan on using something else in the future. And I would like to be able to easily make that change. But I'm getting an error message from the compiler that I don't really understand. I understand what it means but I don't understand it in this context.
Example:
#include <functional>
template < typename Ret, typename... Args > using MyFunc = std::function< Ret(Args...) >;
int main(int argc, char **argv)
{
MyFunc<void(int)> fn;
return 0;
}
Generates:
..\main.cpp|7|required from here|
..\main.cpp|3|error: function returning a function|
template <typename F>
using MyFunc = std::function<F>;
void(int)
is a single (function) type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With