Added: 9 months ago
From: LucasFranchesco
Views: 597
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (2)

Sign In or Sign Up now to post a comment!
  • This was excellent, thank you! One question I have: If you have a function, std::string returnSomeString() { std::string str("Hello"); return str; } wouldn't a temporary be required since str goes out of block and has destructor called?

  • @fortysixfish Thank you for question. Answer is: If your function is called as rvalue reference (RVO is not applied), C++ calls destructor as obvious on function's str object - but before destructor is called, str object is moved (stollen) to object from calling code - so then local str object is null or some garbish and it is fine to destruct ;) If you don't still understand me, feel free to ask me again :)

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more