Re: [boost] [Review] Fixed Strings review period extended

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of David Abrahams Sent: Tuesday, January 31, 2006 10:38 AM To: boost@lists.boost.org Subject: Re: [boost] [Review] Fixed Strings review period extended
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? Joe

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. -- Eric Niebler Boost Consulting www.boost-consulting.com

"Eric Niebler" <eric@boost-consulting.com> 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
participants (3)
-
David Abrahams
-
Eric Niebler
-
Greer, Joe