Results 1 to 2 of 2

Thread: Bi-directional Lookup Table

  1. #1
    Join Date
    Aug 2011
    Posts
    42
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Bi-directional Lookup Table

    I have two columns of data. One has ip address in string format and the other has a numerical value. After toying around with different ways of declaring it, I decided to go with QMap. But the problem is I need to search through all the values in the map for a particular number and find its corresponding key. How can i implement this?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Bi-directional Lookup Table

    Two maps or you could use a third-party bi-directional map like Boost::bimap.

    If you are mapping the string "192.168.1.1" to QHostAddress("192.168.1.1") or the matching quint32 then you are probably wasting your time.
    Bear in mind that if you are mapping a string like "www.google.com" to an address then you can have many addresses for that name, and potentially many names for each address.

Similar Threads

  1. LookUp table Implementation in Qt
    By rex in forum Qt Programming
    Replies: 7
    Last Post: 9th February 2011, 14:49
  2. Image resource lookup in OS X
    By stipa in forum Qt Quick
    Replies: 1
    Last Post: 1st December 2010, 08:11
  3. symbol lookup error
    By knishaq in forum Qt Programming
    Replies: 1
    Last Post: 22nd June 2010, 15:22
  4. Dynamic lookup problem
    By jwintz in forum Qt Programming
    Replies: 3
    Last Post: 30th May 2006, 14:19
  5. lookup table
    By georgie in forum General Programming
    Replies: 6
    Last Post: 12th May 2006, 09:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.