Anybody into C++11 rvalue references?

Feb 8, 2012 at 10:25am
I'm trying to digest this:
http://thbecker.net/articles/rvalue_references/section_01.html

So far, I'm having an indigestion.
After my limited experience with D, the rvalue references in C++11 appear clumsy both syntactically (uhm double ampersand, seriously?) and cognitively. They have the coder prematurely solve a performance issue that optimizers should solve themselves.

I hope somebody, other than myself, will write an Article about them soon.

Discussion thread go!
Feb 8, 2012 at 11:15am
rvalue refs fill the biggest of the holes in the C++ type system, which, in turn, finally makes perfect forwarding possible, which in turn makes emplacing and containers of non-copyable types possible.

It also introduces the concept of moving, which sort of existed in the depths of library implementations for a long time, thanks to the compiler optimizations. I don't see it as a performance issue: there are classes that are, conceptually, movable but not copyable. For example, std::thread.
Last edited on Feb 8, 2012 at 11:27am
Feb 8, 2012 at 5:55pm
We can now have a vector of stream objects :D. In most situations you can just ignore rvalue references if you want, and use the language as before.
Feb 8, 2012 at 8:42pm
I'm trying to get to grips with them at the moment - I have 6 differentt website references open as we speak - seem to be getting the hang of it/them.
I think rvalue reference will be useful.
Feb 8, 2012 at 9:53pm
Having dynamic containers of non-copyable objects is a huge benefit indeed - for the longest time when I needed this I would have to use pointers, which provides a huge potential for error.
Topic archived. No new replies allowed.