This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
RE: How about basic_string<UTF-8> ?
- To: "Lib3 (E-mail)" <libstdc++@sourceware.cygnus.com>
- Subject: RE: How about basic_string<UTF-8> ?
- From: "Edwards, Phil" <pedwards@ball.com>
- Date: Tue, 18 May 1999 09:56:56 -0600
- Cc: 'Shiv Shankar Ramakrishnan' <Shiv@pspl.co.in>
+ 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 charlike types, and objects of char
# like types are called charlike 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