CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 21

Threaded View

  1. #13
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588
    If you need it to be sorted, then yes, std::map is pretty much the only option.

    Custom allocators are not *that* easy, so I can't write an example off the top of my head, but there is a good example in boost's pool library. It will definitely help with memory fragmentation if you use a custom allocator, but how you design it depends very much on your usage scenario.

    But some sites say that memory space available in your machine is the limit for map.
    Yes, in theory that's true, in practice you may run into other problems first.

    Why do you need that many elements in the map ? Why does it have to be sorted ? Are you inserting / deleting elements during operation or is it rather a fixed structure ?

    P.S. With 100.000 elements, you might still find std::map to be OK, but of course the problem is that deleting the whole data in one go is bound to be horribly slow (that's because of the allocator).
    Last edited by Yves M; November 13th, 2003 at 08:09 AM.
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured