I know that the use of auto
keyword can automatically deduce the type of the variable from the Rvalue. Then why does the following function snippet in my code have a compilation error?
auto getName(auto str = "John Doe") {
return str;
}
The compilation error is 'auto' not allowed in function prototype. I googled a bit and I think auto
can not be used in the function prototypes. Why So?
Aucun commentaire:
Enregistrer un commentaire