Thread: Multiset stl

  1. #1
    Registered User
    Join Date
    Jan 2009

    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
    Provide a comparator that reverses the comparison.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jan 2009
    can u tel me wat i should do in the form of code

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

    #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, 05: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