std::string f(){ return "xx"; } int main(){ const std::string& ref = f(); // use ref }
f returns temporary string by value. main "catch" it by const reference. Is it ok in C++?
f
main
Aucun commentaire:
Enregistrer un commentaire