[xsde-users] memory management of "variable length" elements

Boris Kolpackov boris at codesynthesis.com
Fri Sep 10 08:49:48 EDT 2010


Hi Ivan,

Ivan Le Lann <ivan.lelann at free.fr> writes:

> What I had in mind was to "type trait" the use of pointer in XSDe/Hybrid 
> generated code. It would then be user's responsability to specialize 
> the trait with "--hxx-prologue" file for the types of its choice.
> He could also hack a libxsde header if he wants to change the default.
> With a default targeting T*, I thought everybody would be happy.
> The "You pay for what you use" axiom is respected.
> 
> I actually hacked one hour in that direction and it seems easier than 
> I first thought, at least in xsde/hybrid compiler code.
> It might be more tricky to end with simple C++ in libxsde/hybrid sequences.
> 
> What do you think about this ?

Template specialization, and especially partial template specialization,
is unfortunately off limits in XSD/e. We still need to support g++ 2.95
(VxWorks 5.x) and eVC++ 4.0 (WinCE). eVC++ 4.0 is pretty much VC++ 6
when it comes to C++ language conformance.

But the idea is not bad. In fact, I used this approach in another
project I am working on (not yet released). One drawback is the more
obscure interface. Compare:

string*
clone ();

to:

pointer_traits<string>::type
clone ();

Boris



More information about the xsde-users mailing list