Boost logo

Boost :

From: Herve Bronnimann (hervebronnimann_at_[hidden])
Date: 2007-12-05 16:20:58

On Wednesday, December 05, 2007, at 12:30PM, "Peter Dimov" <pdimov_at_[hidden]> wrote:
>The standard doesn't guarantee that a std::string is a contiguous array, but
>all existing implementations are. You can use &s[0] and take the risk, or
>you can prefer dispatching on whether s.begin() returns a pointer.

Peter: Section 21.3.1 [string.require] paragraph 3, page 578, of the current working draft:

The char-like objects in a basic_string object shall be stored contiguously. That is, for any basic_string object s,
the identity &*(s.begin() + n) == &*s.begin() + n shall hold for all values of n such that 0 <= n < s.size().

Isn't that what Robert is asking for? Is this a new requirement (i.e., not in C++03)? Indeed, I can't see it in C++03.

Herve Bronnimann

Boost list run by bdawes at, gregod at, cpdaniel at, john at