Re: map::reserve

Discussion in 'C++' started by David Hilsee, Oct 19, 2004.

  1. David Hilsee

    David Hilsee Guest

    "John Harrison" <> wrote in message
    news:...
    > >
    > > Every container has a "get_allocator" member function that returns a

    copy
    > > of
    > > its allocator. You might be able to come up with something that

    retrieves
    > > the allocator and gives it a "hint" that the map will grow in size (like
    > > "myMap.get_allocator().reserve(...)"), but the effort may not pay off
    > > performance-wise. If std::map's allocations are a performance

    bottleneck,
    > > then I could see how that might be a reasonable approach to make your
    > > application faster.
    > >

    >
    > Sounds like a pool allocator might be a better solution to the OP's

    problem.
    >
    > http://www.boost.org/libs/pool/doc/index.html


    I agree. I only mentioned a reserve() member function on an allocator to
    indulge the OP's idea.

    --
    David Hilsee
    David Hilsee, Oct 19, 2004
    #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. dot
    Replies:
    0
    Views:
    404
  2. joeblack
    Replies:
    3
    Views:
    515
    joeblack
    Nov 4, 2003
  3. MarionEll
    Replies:
    0
    Views:
    350
    MarionEll
    Oct 26, 2004
  4. john smith

    vector.reserve

    john smith, Jul 25, 2003, in forum: C++
    Replies:
    5
    Views:
    682
    John Harrison
    Jul 25, 2003
  5. Ralf Goertz

    reserve() for map

    Ralf Goertz, May 12, 2010, in forum: C++
    Replies:
    8
    Views:
    548
    Ralf Goertz
    May 13, 2010
Loading...

Share This Page