This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: About std::vector::resize().


Martin Sebor wrote:

    T *p = &v [0];
    v.resize (n);   // must not reallocate
    assert (&v [0] == p);

Interestingly, this requirement doesn't exist for basic_string (the famous 21.3, p5)
but I don't see either how the proposed algorithm would help in that case, *when*
the underlying data is just an array of PODs.


It could in the case of a 'rope'-like object, for example.

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]