News for hackers. Stuff that matters.
Re:Appending to an std:string character-by-character: how do... by zabzonk on Thursday October 26, 2023 @11:40PM (#38034445)
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

There are no comments on this comment yet.