Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to create a HashTable in C++?

How to create a HashTable in C++?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++data-structuresquestion
7 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    includeh10
    wrote on last edited by
    #1

    For some reasons, I need to create C++ collection classes myself. The array and list are easy to be understood and created. Now I want to create a map or bag class. First thing I think I need to do is to know how to create HashTable for the map class. But I don't know detail concept of HashTable structure in C++. For example, a list collection has a set of objects which contain pointer to next object - this is basic concept of a list collection. I need similar concept for HashTable or Map collection, which is enough to complete them in C++. Any samples, comments and links are highly approciated. Thanks

    B J D 3 Replies Last reply
    0
    • I includeh10

      For some reasons, I need to create C++ collection classes myself. The array and list are easy to be understood and created. Now I want to create a map or bag class. First thing I think I need to do is to know how to create HashTable for the map class. But I don't know detail concept of HashTable structure in C++. For example, a list collection has a set of objects which contain pointer to next object - this is basic concept of a list collection. I need similar concept for HashTable or Map collection, which is enough to complete them in C++. Any samples, comments and links are highly approciated. Thanks

      J Offline
      J Offline
      JudyL_MD
      wrote on last edited by
      #2

      MFC has a CMap class and its source is available.... Judy

      1 Reply Last reply
      0
      • I includeh10

        For some reasons, I need to create C++ collection classes myself. The array and list are easy to be understood and created. Now I want to create a map or bag class. First thing I think I need to do is to know how to create HashTable for the map class. But I don't know detail concept of HashTable structure in C++. For example, a list collection has a set of objects which contain pointer to next object - this is basic concept of a list collection. I need similar concept for HashTable or Map collection, which is enough to complete them in C++. Any samples, comments and links are highly approciated. Thanks

        B Offline
        B Offline
        Budric B
        wrote on last edited by
        #3

        You can use hash_table which is part of stdext. It's not part of standard template library but will work with visual studio. http://www.sgi.com/tech/stl/hash_map.html[^]

        1 Reply Last reply
        0
        • I includeh10

          For some reasons, I need to create C++ collection classes myself. The array and list are easy to be understood and created. Now I want to create a map or bag class. First thing I think I need to do is to know how to create HashTable for the map class. But I don't know detail concept of HashTable structure in C++. For example, a list collection has a set of objects which contain pointer to next object - this is basic concept of a list collection. I need similar concept for HashTable or Map collection, which is enough to complete them in C++. Any samples, comments and links are highly approciated. Thanks

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          includeh10 wrote:

          First thing I think I need to do is to know how to create HashTable for the map class.

          Read up on the subject here.

          "Love people and use things, not love things and use people." - Unknown

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          L 1 Reply Last reply
          0
          • D David Crow

            includeh10 wrote:

            First thing I think I need to do is to know how to create HashTable for the map class.

            Read up on the subject here.

            "Love people and use things, not love things and use people." - Unknown

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            L Offline
            L Offline
            led mike
            wrote on last edited by
            #5

            DavidCrow wrote:

            Read up on the subject here.

            I'm not used to asking questions in CodeProject forums but I'll give it a try. Which is more difficult? 1) Understanding instructional material on writing C++ code for a Hashtable OR 2) Figuring out how to use Google to search for instructional material on writing C++ code for a Hashtable :-D

            led mike

            T D 2 Replies Last reply
            0
            • L led mike

              DavidCrow wrote:

              Read up on the subject here.

              I'm not used to asking questions in CodeProject forums but I'll give it a try. Which is more difficult? 1) Understanding instructional material on writing C++ code for a Hashtable OR 2) Figuring out how to use Google to search for instructional material on writing C++ code for a Hashtable :-D

              led mike

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              i like the second one!

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
              Never mind - my own stupidity is the source of every "problem" - Mixture

              cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/xml>

              1 Reply Last reply
              0
              • L led mike

                DavidCrow wrote:

                Read up on the subject here.

                I'm not used to asking questions in CodeProject forums but I'll give it a try. Which is more difficult? 1) Understanding instructional material on writing C++ code for a Hashtable OR 2) Figuring out how to use Google to search for instructional material on writing C++ code for a Hashtable :-D

                led mike

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                led mike wrote:

                1. Figuring out how to use Google to search for...

                See if this helps.

                "Love people and use things, not love things and use people." - Unknown

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups