Multiset stl

This is a discussion on Multiset stl within the C++ Programming forums, part of the General Programming Boards category; will i be able to use both kinds of multisets(with min and maxheap) within the same prog... if so how..... ...

  1. #1
    dpp
    dpp is offline
    Registered User
    Join Date
    Jan 2009
    Posts
    197

    Multiset stl

    will i be able to use both kinds of multisets(with min and maxheap) within the same prog...
    if so how.....

    The default one is with minheap...
    i need another mutiset with maxheap...
    wat sattement i have to include...
    if this is not possible i shud be thinking of using reverse iterator

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,725
    Provide a comparator that reverses the comparison.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    dpp
    dpp is offline
    Registered User
    Join Date
    Jan 2009
    Posts
    197
    can u tel me wat i should do in the form of code
    thanks

  4. #4
    The larch
    Join Date
    May 2006
    Posts
    3,573
    multiset uses std::less<T> as the default comparison predicate. To reverse the predicate, you'll need std::greater<T>

    Code:
    #include <functional>
    
    std::multiset<int, std::greater<int> > my_multiset;
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C Formatting Using STL
    By ChadJohnson in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2004, 04:52 PM
  2. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-23-2004, 11:22 PM
  3. STL or no STL
    By codec in forum C++ Programming
    Replies: 7
    Last Post: 04-12-2004, 02:36 PM
  4. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 07:26 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21