Could you tell me please whether I am right that use of auto&& for a function return value is always a better choice than use of auto. For instance, in
auto val = someObj.getVal();
the val will be a copy if getVal() returns a reference. However, use of the universal reference auto&& does not have such a disadvantage? The only information I need to know is whether getVal() is const or not.
Thank you in advance!
Aucun commentaire:
Enregistrer un commentaire