[xsd-users] C++ 11 move semantics

Ovanes Markarian om_codesynthesis at keywallet.com
Wed Jul 3 12:13:07 EDT 2013


Boris,

thanks for your answer!


On Wed, Jul 3, 2013 at 3:50 PM, Boris Kolpackov <boris at codesynthesis.com>wrote:

> I am not sure what the appropriate solution is for this case. Initially,
> I thought that always calling std::move() is the right approach, but now
> I am not so sure. For example, if the arg/ret type is an l-value reference
> (not likely but conceivable), then things will break.
>
Mmmm... In my case I just edited the generated code manually. IMO,
std::move is not required. The only fix I'd propose is to get rid of the
temporary l-value:

MyType tmp = parser.do_what_ever(...);
handle_value(tmp);

If you just generate:

handle_value(parser.do_what_ever(...));

Everything should be handled automatically (moved implicitly, since it is
an r-value). Here the library puts the responsibility to the user to create
compatible input/output types.

In that case no explicit move call is needed. Or do I miss smth?


Thanks,
Ovanes


More information about the xsd-users mailing list