Let's say I have a type alias like this:
template <typename Arg>
using Func = std::function<void(Arg)>;
It works fine except for the case when Arg is void:
Func<int> f1;
Func<void> f2; // doesn't compile
The second one gives the following compilation error:
error: invalid parameter type ‘void’using Func = std::function<void(Arg)>;
error: in declaration ‘using Func = class std::function<void(Arg)>’
How can I make it work to create alias for std::function<void()>
?
Aucun commentaire:
Enregistrer un commentaire