|
Boost : |
From: Joseph Gauterin (joseph.gauterin_at_[hidden])
Date: 2007-09-26 17:57:50
> If not, how should I do to replace sub-strings? It is a very common use.
The substring method could return a new string object rather than
modify the old one - C# handles its immutable strings in this way. I'm
not so sure having
>> Strings could be built using a stringstream like approach
> I don't understand what you mean.
Sorry, I wasn't very clear. I meant we would provide a class like
std::stringstream that can have strings (of any encoding) added to it
using <<. It would convert its contents to a string when the str()
method is called (we could pass the required encoding as a
parameter/template parameter).
> You mean having two classes then, isnt it?
It would mean that, yes. One class for the strings (immutable), one
class for constructing the strings.
> > Making the iterator a byte iterator, not a code point iterator, pushes
> > the responsibility for knowing how to handle the variable widthness of
> > the different encodings back onto the user.
>
> So what is your opinion about it? I find it very useless a byte
> iterator, except for copying.
My opinion is also that byte iterators aren't a good idea - if people
want to iterate over bytes than a std::vector<byte> would be more
appropriate.
> > We'll definitely need a way to convert to a raw pointer representation
> > (like std::string.c_str()) for interaction with some APIs.
> Surely
Applications often pass string data to APIs as raw pointers - I think
that the best way to handle this would be to store strings as
contiguous memory within the string class.
These are just my thoughts at the moment as I type. I'll give the
matter some more etensive thought before I reply again.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk