From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-03-06 16:03:40
>From: "Phil Nash" <phil.nash.lists_at_[hidden]>
> > Robert Klarer wrote:
> > > The syntax for declaring a static_string is unfortunate, but once it
> > > been declared, a static_string's interface is (almost*) the same as
> > > of a const std::string.
> > Yes, you right it's unfortunate and IMHO is not appropriate for a wide
> > > typedef boost::static_string<'s', 't', 'a', 't', 'i', 'c', '_'>
> > > StrType1;
> I have to admit I like the idea of having a std::string interface without
> the overhead of dynamic allocation.
Well, you could get that using ordinary string types, as well, e.g.:
template<class CharType,int Size>
However, one thing the static_string may be used for, is for compile-time
computations, including passing it around as a template parameter, as shown
in the OP. The interface is rather inconvenient, though. I played some
around with this about half a year ago, too
(http://article.gmane.org/gmane.comp.lib.boost.devel/3032). However, I
didn't pursue it, because of the difficult way of specifying strings.
> My biggest reservation would by the char-only restriction...
You could also use wchar_t, of course, or any fundamental type, if that's
what you mean?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk