From: Robert Klarer (klarer_at_[hidden])
Date: 2003-03-06 20:52:04


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.