On Thu, 18 Aug 2011 22:33:47 +0200, Trass3r wrote: > Am 18.08.2011, 22:19 Uhr, schrieb Jonathan M Davis > <jmdavisp...@gmx.com>: >> Yeah. I don't understand why a struct literal would be an lvalue. It's >> a temporary. What possible value does it have? It's not a variable. It >> doesn't >> refer to a variable. Why would you be able to assign to anything which >> is not >> a variable (or indirectly refers to one - e.g. with ref)? > > I don't understand it either. > It only makes sense with const ref.
(I suspect that I am confusing issues here; still... :) ) C++11 added rvalue references. They are useful at least for move semantics. (Andrei had worked hard to find an non-intrusive solution but had to settle with an intrusive one: http://drdobbs.com/184403855 ) I remember reading about this in the TDPL. 7.1.3.5 is on topic. Here is an excerpt from page 251: "All anonymous rvalues are moved, not copied. A call to this(this) is never inserted when the source is an anonymous rvalue ..." Good. And when we want to move a named variable, there is std.algorithm.move: kun(move(w)); Ali