
.On Dec 5, 2007 2:04 PM, Robert Ramey <ramey@rrsd.com> wrote:
I've been reading the posts on this subject with interest. I don't have strong position myself. I do believe that some extra effort and/or risk is justified to get best performance. I'm leaving for you guys to do battle over the various alternatives. I strongly believe in const correctness and believe that things are "const" for a reason so I'm not enamored with a const_cast of any kind. I would much prefer a "guarenteed correct" solution if its close to best efficiency.
Hence I like the current suggestion. But does't it presume that s.begin() points to a real array which would be an implemenation feature?. That is, do I know that a standard conforming string is actually an array of adjacent characters?
For C++03 it isn't guaranteed, AFAIK. But the new standard will enforce this. Just as std::vector is guaranteed to be contiguous. So I would say it is ok to expect this from an implementation at this point.
Robert Ramey
[snip] -- Felipe Magno de Almeida