Initially references have been introduced to C++ to hide the ugly pointer syntax much like many modern program languages do.
Now, with smart pointers it looks to me like we have to (again) explicitly use ptr->element
or *ptr.element
instead of just reference.element
.
Is this the price we have to pay for having explicit control over ownership, i.e. being able to either keep it or move it on?
Or do I miss something...?
Aucun commentaire:
Enregistrer un commentaire