C++11 introduced the ability to "ref-qualifier" methods. The most known qualifier is the const one:
however now is also possible to ref-qualify *this
let see how this can be of any use. Immagine to have a factory building heavy objects and
returning them by copy this way:
in the following scenario we can avoid an useless copy:
we can avoid the copy if Jumbo is movable overloading the method getJumboByCopy in case
the object on which I'm calling it is a temporary:
To be honest the example shows a scenario with other problems than the one mentioned (for instance
if the object Jumbo is so big why permitting the copy then?) but I hope you got the idea.
4 comments:
Informative post. Thanks for sharing.
C++ Urdu Tutorial
https://www.vishalbhardwaj.com/2020/07/Commerce-Business-Administration.html
https://www.vishalbhardwaj.com/2020/07/Commerce-Notes.html
https://www.vishalbhardwaj.com/2020/06/what-is-data-structure.html
https://www.vishalbhardwaj.com/2020/07/CPP-in-Hindi.html
Natural herbs have cured so many illnesses that drugs and injections can't cure. I've seen the great importance of natural herbs and the wonderful work they have done in people's lives. I read people's testimonies online on how they were cured of Herpes, Hpv HIV/AIDS & STDs, Diabetics , Gonorrhea, Psoriasis, Hepatitis, etc. by herbal medicine, so I decided to contact the doctor because I know nature has the power to heal anything. I was diagnosed with Herpes for the past years but Dr Chike cured me with his herbs and i referred my aunt and her husband to him immediately because they were both suffering from herpes but to God be the glory, they were cured too .I know is hard to believe but am a living testimony. There is no harm trying herbs. Contact Dr on Whats-App . +2333502715551. text/call via: +1 (719) 629 0982 ,
Very Informative and creative contents. This concept is a good way to enhance the knowledge. thanks for sharing.
Continue to share your knowledge through articles like these, and keep posting more blogs.
And more Information Data Labeling Service for Machine Learning
Post a Comment