Subject: Re: [boost] [General] Always treat std::strings as UTF-8
From: Alexander Lamaison (awl03_at_[hidden])
Date: 2011-01-19 10:16:48
On Wed, 19 Jan 2011 08:55:38 -0500, Chad Nelson wrote:
> On Wed, 19 Jan 2011 12:10:35 +0000
> Alexander Lamaison <awl03_at_[hidden]> wrote:
>>On Tue, 18 Jan 2011 20:37:44 -0500, Chad Nelson wrote:
>>> My utf8_t class lets you get the std::string with operator*, so it's
>>> easy to use with such encoding-agnostic functions as well.
>> I meant to mention this: please, no ;) Can we make it .raw()
>> or .str() or something, anything but an operator overload?
> operator* has a long history of providing the contents of a variable,
> even in C, and is a lot less typing to boot. But if you have any
> technical arguments against it, I'm listening.
operator* in not about providing the contents of a variable, it is about
dereferencing something that points to an address, be that a real pointer,
a C++ iterator, etc. utf8_t is just a class holding it's internal data as
a std::string. In a similar way to std::stringstream which gives access to
its internal string via .str() or std::string which serves up a raw char*
string via .c_str().
While we're questioning cosmetic details, I'm wondering about the choice of
utf8_t vs utf8 or utf8_string. What does the _t signify? I was under the
impression that _t meant typedef; for example wchar_t started life as a
typedef rather than a primitive data type.
-- Easy SFTP for Windows Explorer (http://www.swish-sftp.org)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk