Hello,

for performance reasons, I would like not to have to have a std::wstring (1 allocation/1 deallocation of its character array) in one routine and instead have a wchar_t[MAXSIZE]. But I also would like my code to be correct for sizes bigger than MAXSIZE.

Is there some type (in boost or elsewhere, preferable for both basic_string and vector) that defaults to stack-allocated array of some size (preferably configurable by a template parameter), and in case of overflow (i.e. push_back or insert when it's full), would allocate a dynamically-allocated array? This is how it works on MSVC with their STL basic_string implementation, just the array size is unconfigurable (16 bytes including null-terminating byte). I would obviously choose the MAXSIZE so that 99.9% of cases are handled by the stack-allocated array.

Thanks,
Boris