Boost logo

Boost :

From: Martin Wille (mw8329_at_[hidden])
Date: 2006-07-07 02:14:11


Pavel Vozenilek wrote:
> "Martin Wille" wrote:
>
>> So if we add the suggested super string then PLEASE
>> do not name it 'string', but 'string_builder' or 'string_buffer' in
>> order to emphasize on the in-place modification aspect in the name. Of
>> course, there should be a complement to string_builder:
>> immutable_string. (ISTR there was a proposal for that, already).
>>
>
> One posibility is to use Boost.Const String
> (should be sitting somewhere in review queue) so that:
>
> super_string<char, std::basic_string<char> >
>
> would provide mutable interface and
>
> super_string<char, boost::const_string<char> >
>
> would be limited to immutable operations.
> The const_string variant may also avoid the basic_string overhead.

Frankly, I don't see the benefit of that. std::string and const_string
are already working string implementations. Why add a wrapper around
them? The suggested wrappers still have different types and even
different interfaces. The latter would certainly be confusing.

A wrapping approach would make sense if (raw) buffers could be wrapped:

E.g. super_string< vector<char> >, or super_string< boost::array<...> >
or super_string< char[N] > or even super_string< view<...> >

super_string< char[N] > would have the advantage that it can operate
entirely on the stack which helps reduce the dynamic allocations (which
is the purpose of a string buffer).

Regards,
m
Send instant messages to your online friends http://au.messenger.yahoo.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk