|
|
Fredrik Eriksson wrote:
> On Tue, 02 Sep 2008 22:22:46 +0200, Darren New <dne### [at] sanrrcom> wrote:
>> One of my problems with learning C++ is the number of places where,
>> instead of saying "This is what this feature does", people say "this
>> is how you use this feature."
>
> Perhaps because the rules are sometimes so complex that few really know
> exactly what a particular feature does under all conditions. It is much
> easier to say "if you do it like this, it works" than to list all the
> many cases where it does something slightly or vastly different.
Yeah, basically. "We don't actually know what the semantics are. We
just all know the idioms for using the feature."
>> What is a "move constructor"? When would you be "moving" some value?
>
> "Moving" a value is useful when you know that the source value will be
> discarded anyway right after the copy is performed, e.g. if it is the
> return value of a function. Many objects that are expensive to copy can
> be "moved" much more efficiently.
But the rvalue thing doesn't move a value. What does the rvalue thing
actually *do* that's different from anything else? Isn't it that it
points to a temporary with a guarantee of no aliases?
> Note that non-temporaries can also be bound to r-value references, but
> not implicitly.
Well, yes, because C++ lets you break anything. That's not the point,
tho. :-)
--
Darren New / San Diego, CA, USA (PST)
Post a reply to this message
|
|