mardi 18 décembre 2018

Generic std::function to store a generic lambda

When generic lambda is stored as a std::function, we need to provide a concrete type, something like,

std::function<double(double)>

thus binding to a specific type,

The following declaration:

std::function<auto(auto)>

throws a compiler error.

I understand that, from c++14 onwards, auto can be used to store return value of a lambda, but is there a way to achieve this when storing a lambda in std::function?

Aucun commentaire:

Enregistrer un commentaire