[xsd-users] C++ 11 move semantics
Boris Kolpackov
boris at codesynthesis.com
Thu Jun 27 08:06:38 EDT 2013
Hi Ovanes,
Please don't post multiple copies of the same. If you sent it from an
unsubscribed address, just wait for it to go through moderation.
Ovanes Markarian <om_codesynthesis at keywallet.com> writes:
> The base parser skeleton has the following construct:
>
> std::unique_ptr<what_ever_type> tmp
> (this->Underlying_parser_->post_WhatEverType());
> this->WhatEverType (tmp);
>
> Here I need to either use an explicit move: std::move(tmp) or pass the
> r-value to the WhatEverType function:
>
> std::unique_ptr<what_ever_type> tmp
> (this->Underlying_parser_->post_WhatEverType());
> this->WhatEverType (std::move(tmp));
>
> or
>
> this->WhatEverType(this->Underlying_parser_->post_WhatEverType())
>
>
> Is there any work around for that?
A few that I see:
1. Accept the pointer in WhatEverType() as an l-value reference. Inside
you can call std::move() yourself.
2. Use shared_ptr.
> Can I specify in a type-map file a move function to be used.
No, this is not currently supported.
Boris
More information about the xsd-users
mailing list