3 ms·
i think you may have misunderstood the standard - data() will always return a valid pointer, but the pointer returned may be invalidated by any number of functi
by zabzonk 3y ago
i think you may have misunderstood the standard - data() will always return a valid pointer, but the pointer returned may be invalidated by any number of functions:
string s;
s.reserve(50);
char * p = s.data(); // ok so far
s.reserve(100); // now p may be invalid