>From: "Robert Klarer" <[EMAIL PROTECTED]> > Terje Slettebų wrote: > > > 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); > > An implementation of basic_string that uses the small string optimization already > implements something very close to this. We don't need to specify an entirely new > kind of string to benefit from this technique.
True, for small strings. However, that particular technique doesn't work for larger strings. I just mentioned the above, since it appeared that much of the interest for static_string came from the lack of dynamical allocation, so I wanted to point out that you don't need compile-time computation for that. Naturally, a compile-time string would be much less expensive to copy around, though, since it's all encoded in the type, and there would be no run-time cost for many operations. Regards, Terje _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost