Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-03-06 15:54:14


At 05:58 PM 3/5/2003, Robert Klarer wrote:

>There's already been some discussion of this library under the thread
>"Proposal: strings as template parameters," but static_string hasn't
>been the subject of its own thread, so I'm starting this one. I'd like
>to solicit opinions about this project. Is it worthwhile?
>
>The purpose of the static_string library is to offer an alternative to
>string literals and the standard type const std::string. A
>static_string uses no dynamically allocated memory, and is more
>efficient at execution time than either string literals or
>basic_strings.

Yes, agreed. That would be useful. IIRC, the C++ committee's performance
working groups has talked about such a string in the past.

But...

>The syntax for declaring a static_string is unfortunate...
>
> boost::static_string<'s', 't', 'a', 't', 'i', 'c', '_'> StrType1;

Unfortunate? Is that one of those understatement jokes Canadians are known
for? I'd say it is way worse that "unfortunate" - it is ugly and error
prone.

Lack of internationalization support is also a serious concern.

There are questions that come to mind:

* Can you come up with a small, workable language extension that eases
those problems?

* Can you come up with an alternate design that gives up a tiny bit of
efficiency (one pointer indirection perhaps) but then allows reasonable
construction and internationalization?

Wondering-out-loud,

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk