Matt Austern - Re: Char_traits (part 2+) (original) (raw)

This is the mail archive of the libstdc++@gcc.gnu.orgmailing 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]
Other format: [Raw text]

On Friday, August 16, 2002, at 11:42 AM, Gabriel Dos Reis wrote:

Sometime ago (one? two years), I was working on the char_traits<> thingy seeking for ways to provide points-of-customization for users -- but I gave up, being distracted by other things (and ironically enough, I ditched the patch from my disk two weeks ago :-(( )

The real problem is that specializing char_traits isn't enough. A user who wants to define a new character type, and have it be usable on equal footing with char and wchar_t, must do these things:

The first three are reasonable enough: you define a type, and you tell the system its traits. The others are a mess. You'll have to rewrite lots of the guts of a standard library implementation. The granularity of this customization is awkward at best.

(And note that this still won't get you the ability to use your new character type with named locales. All it'll get you is the ability to imbue a stream with some locale that works. If you want to use your new character type, and also use locales to encapsulate different cultural conventions, you've got more work ahead of you. I'm not sure how much more work, because I'm not sure what the interface might look like.)

A project I've been putting off for several years is defining a new character type, doing all the user-level library work that's required to get it to work (i.e. not taking advantage of any library implementation's private internals), and writing an article showing other people how to do it. It's a nontrivial project. If anyone wants to work with me on it, it might finally get me to stop procrastinating.

        --Matt

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