This question already has an answer here:
- Omit return type in C++11 7 answers
- A lambda's return type can be deduced by the return value, so why can't a function's? 5 answers
My question is, why can't the return type of a function be deduced ? , or more simply why the following code gives error :
auto myfunc(int a)
{
int a = 12;
return a;
}
Why this isn't valid ?
Aucun commentaire:
Enregistrer un commentaire