lundi 2 mars 2015

C++: Keeping rvalue reference implicitly for fields of a smart pointer

Let f() be a function that returns a unique_ptr<X> and let m be a member field of X. While f() can be used as an rvalue reference, f()->m cannot, forcing me to use move(f()->m).


Assuming that I can define my own unique_ptr instead of using the existing one, is there a way to make my -> operator keep the rvalue-ness? If this is not recommended, please explain why.


Aucun commentaire:

Enregistrer un commentaire