[xsd-users] Howto avoid slicing with xsd-types to std::string

Tempelaar E. (Erik) Erik.Tempelaar at vanoord.com
Tue Oct 12 05:17:31 EDT 2021


Hello,

Our codebase gets analyzed by sonarcloud and recently they upgraded the analyzer to warn about slicing.
As a result we get warnings for code that interacts with xsd-generated types with assignments where the resulting type is simply a std::string.
(xsd:simpleType with xsd::restriction base="xsd:string")

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es63-dont-slice
The guidelines suggest to define an explicit operation to do so, but I could not find it.

Any suggestions? Thanks in advance.

Erik








Disclaimer: This mail transmission and any attached files are confidential and are intended for the addressee only. If you are not the person or organization to whom it is addressed, you must not copy, disclose, distribute or take any action in reliance upon it. If you have received this message in error, please contact the sender by email and delete all copies of this message and all copies of any attached files.


More information about the xsd-users mailing list