On Tuesday 07 March 2006 20:29, Scott Cantor wrote:
> > Something like this? Perhaps I could delay the conversion
> > until I call the conversion operator?
>
> Far more exotic than anything I bother with, but roughly yeah. I think
> you're overestimating the need for all this in practice, but you know your
> app better than me.

Oh, that XCPtr was quite easy to create. I just took the code from Josuttis's 
Library book and made a few modifications.  The reason for wanting to delay 
the conversion is so I could have a single handle for either char* or XMLCh*.  
If I construct it with non-transcoded data, and call it to return that type, 
I never pay for the translation.  If I do happen to call the conversion 
operator that requires trancoding, I can then have the destructor 
automatically release it.  That will probably be much easier than the XCPtr.
 
> >   ~XCPtr() throw() { XS::transcode(x_ptr); }
>
> I think you're intending to call XMLString::release there.

Whoops! Thanks.

> All I do is implement non-copyable smart pointers that transcode or
> replicate an initial value depending on whether it's Unicode or ASCII.
> That's all I ever needed. I'm not even willing to use them as input to the
> DOM methods in place of literals, the runtime cost is just way more than I
> want to pay.

I don't follow you there.  Are you suggesting you create global constants, or 
something like that?  You certainly need to pass /something/ to the DOM 
methods.

Steven

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to