|
-
June 28th, 2012, 10:55 PM
#30
Re: std::string and contiguous memory?
 Originally Posted by sszd
It has been guaranteed in the present by the fact that all known implementations of std::string do guarantee these things, and the latest C++ standard that was approved last year guarantee that all future implementations will be compliant as well, so it is overly paranoid to assume otherwise.
I think he's right here. You're not writing code to be that may be compiled with an older standard library implementation that may be unknown to you, so just check that what you have satisfies the assumption (it probably does). If so, all is well: go ahead and use &s[0] even if the standard library implementation was written at a time when the current guarantees did not exist.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|