Thread: Maps

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    197

    Maps

    Is thre any way to print only the distinct pairs ..
    say for eg: i have: key and mapped values as:
    Code:
    1 2
    1 3
    2 4
    1 2
    1 2
    I need only
    Code:
    1 2
    1 3
    2 4
    Ofcourse i use multimaps...

    I am asking whether there is any function that does this...
    I have to do it manually in the worst case

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Perhaps you should be using a std::set<std::pair<int, int> >.
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Loading maps
    By divineleft in forum C++ Programming
    Replies: 1
    Last Post: 07-05-2006, 10:09 AM
  2. Hash_map, STL maps query
    By alvifarooq in forum C++ Programming
    Replies: 15
    Last Post: 06-07-2005, 09:07 AM
  3. DDX/DDV and Message Maps
    By axr0284 in forum Windows Programming
    Replies: 2
    Last Post: 01-07-2005, 08:55 AM
  4. maps as reference?
    By robquigley in forum C++ Programming
    Replies: 2
    Last Post: 11-26-2003, 09:12 AM
  5. Finding terrain maps...
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 09-25-2001, 07:44 PM