|
Boost Users : |
Subject: Re: [Boost-users] [move] Move c-tor template
From: Szymon Gatner (szymon.gatner_at_[hidden])
Date: 2012-04-01 18:45:57
>
> Unfortunately, you can't catch rvalues of a move-emulation-enabled type in a
> deduced context as you've tried to above (in C++03). If you want some ideas
> on how to get something like this to work, search the Boost developer list
> under the messages subject "[boost] [move] new rvalue reference emulation".
>
> The easiest solution, though, is simply to split the construction into two
> steps:
>
> clone_ptr<D> d = makeD();
> clone_ptr<B> b = boost::move(d);
>
> (This still requires the additional constructor you've given above!) I
> *think*, due to RVO, there shouldn't be any overhead with the above pair of
> statements compared with rolling everything into a single statement.
>
> If this doesn't fulfill your needs, I suggest reading through the thread
> given above in the Boost developer list.
>
Thanks a lot for your answer, reading into the source you suggested now.
It is a serious drawback of move emulation tho imho as pointer
upcasting is rater basic (smart) pointer related stuff.
Time to update a compiler I guess ;)
Cheers!
Simon
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net