[C++-sig] Re: Creating an arbitrary sized boost string ?
David Abrahams
dave at boost-consulting.com
Fri Sep 5 22:32:57 CEST 2003
John Janecek <jjanecek at telusplanet.net> writes:
> I can create a string using
>
> str(char* data)
> where data is a null terminated string
>
> what about if data is not a null terminated string ?
>
> like i need something like
> str(unsigned char* data, datalen)
>
> how can i do this ?
Probably the easiest way is with:
str(std::string(data, data+datalen))
I agree that it would be nice to have the constructor you're asking
for, but it would be a departure from the Python interface; is it a
good idea? It might be...
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list