Given the following code snippet:
struct T {};
std::function<T&(T&)> f = [](T& obj) -> T& { return obj; };
I was wondering if it is possible to infer the correct lambda return type (i.e. T&) without using trailing return type syntax.
Obviously, if I remove -> T& then a compile-time error will occur in that the deduced type would be T.
Aucun commentaire:
Enregistrer un commentaire