Boost logo

Boost :

From: John Nagle (nagle_at_[hidden])
Date: 2004-05-12 20:57:42


    If you're willing to accept a call to "new", you can just
use std::string and reserve some initial size. So you don't
need that capabiilty in char_string. char_string is
for situations when you don't want to invoke dynamic allocation
at all. In desktop applications, that's not too common, but in
real time work, inside operating systems, and in embedded
applications it's not unusual.

    char_string is also useful for retrofitting old code to
protect it against buffer overflows.

                                John Nagle
                                Team Overbot

David Abrahams wrote:
> "Reece Dunn" <msclrhd_at_[hidden]> writes:
>
>
>>>I presume you're referring to fixed-capacity strings which can
>>>have a variable size, right?
>>
>>yup. The idea is to make it a buffer-overflow safe replacement for C
>>style character buffers, e.g.:
>>
>> char buf[ 100 ];
>> ::sprintf( buf, "...", ... );
>>
>>while allowing it to behave like a basic_string.
>
>
> Why not make an unlimited-size string with a parameterized internal
> "small string optimization" buffer?
>


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