>From: "Beman Dawes" <[EMAIL PROTECTED]> > At 05:58 PM 3/5/2003, Robert Klarer wrote: > > >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. > > There are questions that come to mind: > > * Can you come up with a small, workable language extension that eases > those problems?
Josuttis/Vandevoorde mentions being able to pass string literals as template parameters as a possible future extension. That would be a clean way to handle it. Possibly could there also be a general solution regarding passing compound values. At the moment, values of class type can't be passed as template parameters. > * 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? If run-time computation is ok, and that one only wants to avoid dynamical allocation, then one might do something like I used in another posting in this thread: template<class CharType, int N> class fixed_size_string; template<class CharType, int N1, int N2> fixed_size_string<CharType, N1+N2> operator+(const fixed_size_string<CharType, N1> &s1, const fixed_size_string<CharType, N2> &s2); etc. Regards, Terje _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost