Re: std::vector memory allocation

Discussion in 'C++' started by John Harrison, Jun 25, 2003.

  1. "onion_skin" <> wrote in message
    news:...
    > When a std::vector has to allocate more memory, am I correct in
    > thinking that it allocates additional memory of equal size to the
    > amount of memory required to store the existing number of elements?


    No that's not correct, and wouldn't be efficient enough.

    Actual method is implementation defined, doubling the capacity each time
    would be a possible method however.

    john
     
    John Harrison, Jun 25, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chandra Shekhar Kumar

    Re: std::vector memory allocation

    Chandra Shekhar Kumar, Jun 25, 2003, in forum: C++
    Replies:
    0
    Views:
    2,284
    Chandra Shekhar Kumar
    Jun 25, 2003
  2. Andrew Koenig

    Re: std::vector memory allocation

    Andrew Koenig, Jun 25, 2003, in forum: C++
    Replies:
    0
    Views:
    946
    Andrew Koenig
    Jun 25, 2003
  3. Ken
    Replies:
    24
    Views:
    3,875
    Ben Bacarisse
    Nov 30, 2006
  4. Replies:
    8
    Views:
    1,929
    Csaba
    Feb 18, 2006
  5. Rune Allnor
    Replies:
    4
    Views:
    954
    Rune Allnor
    Dec 11, 2008
Loading...

Share This Page