[xsd-users] C++ Move Semantics
Soroush Rabiei
soroush.rabiei at gmail.com
Tue Aug 6 07:04:52 EDT 2013
Hi list
I've encountered a problem with XSD parser. I have a couple of move-only
C++ classes that should be generated from xml file. I'm using type map file
as described in the documentation. The problem is that generated code have
a lot of errors. Since there is no copy constructor in my classes, compiler
refuses to pass tmp as an l-value.
This is map file: (xcsp.map)
// ...
variable_t AIT::CSP::Variable AIT::CSP::Variable;
// ...
Generated code:
AIT::CSP::Variable tmp (this->variable_parser_->post_variable_t ());
this->variable (tmp); // <== error: cannot bind 'AIT::CSP::Variable'
lvalue to 'AIT::CSP::Variable&&'
That should be either :
this->variable (this->variable_parser_->post_variable_t ());
Or this:
AIT::CSP::Variable tmp (this->variable_parser_->post_variable_t ());
this->variable (std::move(tmp));
Currently I'm modifying generated files manually. That's difficult to
maintain and badly breaks our teamwork. We've discussed about changing our
XSD parser staff with a new one. Though it needs huge amount of effort and
time to change a large codebase. I think a patch in XSD is better in terms
of maintenance and effort.
I just cloned xsd repo. How can I change the code to modify produced codes
as mentioned above? The other question is that should I release the patch
or provide a link in project homepage? I'm not familiar with legal aspects
of the library. Our project is GNU LGPL 2.1.
Cheers
Soroush
More information about the xsd-users
mailing list