This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: How about basic_string<UTF-8> ?



+ basic_string<T>::operator +=(T c);
+ This operation will only work for ascii chars which are one 
+ byte long in UTF-8.

Why?  The very first paragraph of the strings clause states:

#   This clause describes components for manipulating sequences of
#   "characters," where characters may be of any POD (3.9) type. In this
#   clause such types are called char­like types, and objects of char­
#   like types are called char­like objects or simply "characters." 

As long as whatever you pick for T (when instantiating basic_string) is a
POD type, then op+= is defined to work.


+ basic_string<T>::reference basic_string<T>::operator[](size_type pos);
+ This operation is meaningless for anything but a pure ascii string ...

Why?

+ You can get any byte in a character and it would be an unit 
+ of storage not necessarily a character.

basic_string<T>::reference is of type T&, whatever that may mean.  It does
not have to be a single byte in size.


+ Finally, adding support for an UTF-8 string is far beyond the 
+ scope of a
+ standart C++ library.

We are in agreement there.  But there's no reason why it couldn't be done as
an extension, or even (shameless plug) a HOWTO.


Luck++;
Phil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]