Re: CString help

Tech-Archive recommends: Fix windows errors by optimizing your registry



How are you reaching that (wrong) conclusion? Until I understand why you
say that, it's pointless to talk about its (non-existent) consequences.

The technique writes to &s[0]
operator[] is defined in terms of data().
But data is const value_type *data() const;
This means that the stuff pointed by data should not be changed, and
that the basic_string object itsef is not changed.

So writing in &(s.data()[0]) basically breaks this contract.
The fact that the buffer is contigous does not change this.
At least this is my reading. What is wrong here?


--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
.



Relevant Pages