[xsd-users] Map types on std::pair and std::map
Boris Kolpackov
boris at codesynthesis.com
Wed Dec 4 06:02:31 EST 2013
Hi Chris,
Chris Delnooz <Chris.Delnooz at hydrix.com> writes:
> I am wondering if it would be possible to map certain complex types
> onto std::pair and std::map or something that behaves similarly.
While you cannot map generated types to std::pair or std::map directly,
you can map them to types derived from these standard types. This will
make them pretty much eqivalent since you will be able to pass your
custom types where one of the standard types is expected. For example:
class LabelWeight: public std::std::pair<int, int>
{
...
};
The way to achieve this is to use the type customization mechanism
provided by C++/Tree. For more information on type customization
see the C++/Tree Mapping Customization Guide:
http://wiki.codesynthesis.com/Tree/Customization_guide
As well as the examples in the examples/cxx/tree/custom/ directory.
The one that is the closest to what you are trying to do is probably
'contacts'.
Boris
More information about the xsd-users
mailing list