Re: CString help



On Sun, 24 Jun 2007 14:33:54 -0700, "Mihai N." <nmihai_year_2000@xxxxxxxxx>
wrote:

But reading it, I still think there is no decend standard way to write
something in a standard string in a standard way.
Even if the storage is contigous, the data is still const, you I cannot
safely change it.

The following will be fine:

string s;
s.resize(n);
memcpy(&s[0], 0, n);

One of the benefits to requiring s[0] to return a real reference (which is
what disallows COW) is that &s[0] returns a real pointer.

--
Doug Harrison
Visual C++ MVP
.


Loading