lundi 5 décembre 2016

using a std::function or a forwarding reference as general-purpose callable object input parameter of a higher-order function?

I was wondering about the main differences, pros and cons in writing a higher order function taking, as input parameter, a std::function or a forwarding reference, e.g. template<typename F> void hof(F&& fun);, as input parameter. Obviously, the former is more strict than the latter in that it specifies the function type that the input callable object has to conform to.

Aucun commentaire:

Enregistrer un commentaire