[cfe-dev] C++ Constructors & Destructors in the AST
Gordon Henriksen
gordonhenriksen at me.com
Mon May 18 16:16:31 PDT 2009
On 2009-05-18, at 10:45, Douglas Gregor wrote:
> On May 16, 2009, at 12:47 PM, Anders Carlsson wrote:
>
>> Here's a patch that makes FullExprArg wrap an object instead.
>>
>> One idea I have is to make FullExprArg just be a smart pointer
>> style wrapper around FullExpr, so we don't have to duplicate the
>> ExprArg API.
>>
>> Comments, thoughts?
>
> This is one ugly const_cast...
>
> + FullExprArg(const FullExprArg& Other)
> + : Expr(move(const_cast<FullExprArg&>(Other).Expr)) {}
If FullExprArg is itself movable/not copyable, wouldn't accepting
Other by value (and adding an unimplemented copy ctor) eliminate the
need for the const_cast?
I've only needed const_cast's with C++03 move emulation in cases where
VC++ is too daft to apply the RVO.
— Gordon
More information about the cfe-dev
mailing list