[C++-sig] Auto-converting to a custom string type?

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Mon Jul 18 20:17:21 CEST 2005

--- Aaron Bentley <abentley at panoramicfeedback.com> wrote:

> Aaron Bentley wrote:
> > Our library uses a custom unicode string type called 'StringBuffer'.
> > I'd like to be able to auto-convert python unicode objects into
> > StringBuffers, because the alternative (AFAICT) it to wrap every
> > function that takes a StringBuffer parameter.
> Not solved yet, but progress:
> I found Ralf Grosse-Kunstleve's approach, and I got it to work
> http://mail.python.org/pipermail/c++-sig/2002-November/002640.html

This may be a better approach (but I haven't looked at your code very closely):


> So now the problem is that if I construct a StringBuffer from a
> StringBuffer, it tries (and fails) to invoke StringBuffer.encode.  I
> don't really want to support StringBuffer.encode, since repeated
> encodes/decodes are pretty inefficient....

Let us know if the URL above doesn't help.


Yahoo! Mail for Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 

More information about the Cplusplus-sig mailing list