Boost logo

Boost :

Subject: Re: [boost] [move] move assignment from lvalue returned by func (was: one more dumb question)
From: Jeffrey Hellrung (jhellrung_at_[hidden])
Date: 2010-02-26 15:34:31


DE wrote:
> on 26.02.2010 at 21:27
> Jeffrey Hellrung wrote :
<snip>
>> For a simple demonstration of the basic mechanism (untested, so not sure
>> if it will compile, but it should give the basic idea)
>> [code here]
> oh now i get it! i didn't realize there are operator rv<T>& and its
> const counterpart hidden behind the macros
> thanks for your effort explaining this

No problem. I have suggested to Ion that a section of the Boost.Move
documentation should be devoted to explaining how the mechanism works.

<snip>
> so summing it all up i say that this solution is far too tricky to be
> useful

I think the same could be said for a lot of "tricks" Boost libraries
employ ;) I'd have to put Boost.EnableIf and Boost.Preprocessor in the
category of code that uses language features in non-obvious ways.

> no offence
> it seems to me too restrictive and too incomplete
> the infrastructure is too complicated

Regarding "too restrictive and too incomplete", you still can't get
perfect forwarding. But otherwise, you pretty much get identical
behavior as with C++0x rvalue references. So I would disagree with this
claim.

Regarding "too complicated", the basic mechanism (and most of the
nastiness) can be encapsulated behind a macro, and as long as you adopt
certain conventions, writing move-aware code otherwise is very easy.
 From the user's point-of-view, there is some complication and extra
consideration, but not really any more than you'd have with true rvalue
references.

However, everyone's entitled to their own opinion ;)

<snip>
> another question arises: who is the target audience (aka users) of
> this lib?

I use it, and I think Chris stated the motivation for using it very
well. I believe it can be targeted to anyone wishing to write
move-aware code.

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk