mardi 28 février 2017

Functions signatures differences C++

Could you explain me which are the differences between these three functions signatures? Why can auto be used as returned data type and not in parameters declarations? Thank you.

//auto f1(auto x) { return x; }   not accepted

auto f1(int x) { return x; }

auto f2(double x) -> decltype(x) { return x; }

template <typename T> 
T f3(T x) { return x; }

Aucun commentaire:

Enregistrer un commentaire