From: Leigh Johnston on
Herb Sutter on &s[0]:

.. In current ISO C++ (C++98 and C++03), std::string is not fully required to
store its data contiguously. You're supposed to use str.c_str() to get a
pointer to a contiguous and null-terminated string (albeit a read-only
string). However, current ISO C++ does require &str[0] to cough up a pointer
to contiguous string data (but not necessarily null-terminated!), so there
wasn't much leeway for implementers to have non-contiguous strings, anyway.
For C++0x we have already adopted the guarantee that std::string contents
must indeed be stored contiguously. For details, see
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#530 .



First  |  Prev  | 
Pages: 1 2 3 4 5 6
Prev: Visual Studio 2008 on Windows 7
Next: std::vector error