[xsd-users] C++ 11 move semantics
Boris Kolpackov
boris at codesynthesis.com
Thu Jul 4 05:36:58 EDT 2013
Hi Ovanes,
Ovanes Markarian <om_codesynthesis at keywallet.com> writes:
> 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?
The reason we have a temporary in the first place is older/broken
C++ compilers. For example, IBM xlC cannot pass std::auto_ptr without
a named temporary.
So what I did is add --std option which allows one to specify the
C++ standard that the generated code should conform to. If you
specify --std c++11, then the temporary is not generated. This
fix is in the repository for the next release.
Boris
More information about the xsd-users
mailing list