Boost logo

Boost :

Subject: Re: [boost] [move] problem with msvc and BOOST_MOVABLE_BUT_NOT_COPYABLE
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2010-05-28 13:32:45


David Abrahams wrote:
> > I'm talking about the BOOST_COPYABLE_AND_MOVABLE case. Most compilers
> > won't do RVO for code written like "X X::create()".
>
> You are claiming that some aspect of that signature causes RVO not to
> happen? What aspect?

I was talking about the signature, but about the way "X X::create()" was written:

X X::create()
{
    X x;
    return x; // passing value form static memeber-fn
}

The expectation that the statement "return x;" will benefit from RVO might not be justified here. Writing "return boost::move(x);" might actually be a good idea.
 
Regards,
Thomas


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