$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: David Abrahams (dave_at_[hidden])
Date: 2006-01-31 13:56:54
"Eric Niebler" <eric_at_[hidden]> writes:
> Greer, Joe wrote:
>>
>>> -----Original Message-----
>>> On Behalf Of David Abrahams
>>>
>>> std::string str(30, 0);
>>> someoldcapi(&str[0]);
>>> str.resize(str.find(0));
>>> str.find(...)
>>>
>>
>> I didn't think strings were guaranteed to be contiguous, or did that get
>> slipped in when I wasn't looking?
>>
>
> Sadly, you're correct. strings are not guaranteed to be contiguous. I'm
> not aware of a std library that takes advantage of that leeway, though.
...and you're not allowed to modify the array that data() points at; drat.
But this is all beside my point: we could easily provide a
contiguous_string library (maybe it just forwards basic_string and
basic_wstring on implementations where the characters *are*
contiguous) that would serve this purpose.
...or use vector<char> ;-)
-- Dave Abrahams Boost Consulting www.boost-consulting.com