>From: "Phil Nash" <[EMAIL PROTECTED]> > > Robert Klarer wrote: > > > The syntax for declaring a static_string is unfortunate, but once it has > > > been declared, a static_string's interface is (almost*) the same as that > > > of a const std::string. > > Yes, you right it's unfortunate and IMHO is not appropriate for a wide > use. > > > > > 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> class fixed_size_string { // ... private: CharType array[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? Regards, Terje _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost