[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost
Subject:    Re: [boost] Interest in super string class?
From:       Jeff Garland <jeff () crystalclearsoftware ! com>
Date:       2006-07-09 17:06:36
Message-ID: 44B1379C.4080503 () crystalclearsoftware ! com
[Download RAW message or body]

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.

After some further experimentation and consideration I've

1) created a const_super_string variant that is immutable (will upload soon)
2) dropped the second template parameter for the base string type

The immutable form is, as you suggested, based on the proposed 
boost::const_string.  It provides only const functions and is thread safe -- 
while the mutable form is not. In the mutable form I've removed the *_copy 
functions to reduce the 'fatness' of the interface.

I dropped the string_type template parameter after actually doing the 
implementation of const_super_string.  The reality is that the implementation 
relies on the underlying string type and you can't just drop in a new base 
string type easily.  The likelihood of using that parameter seems rather 
remote.  And the extra parameter complicates the documentation and the usage 
interface -- of which the goal is to make as easy as possible.

Jeff

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic