help in maps

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stlnew
    New Member
    • Jul 2006
    • 2

    help in maps

    I am new to using stl

    can we iterate through the map.

    i need to delete the map to do so i do understand i have to delete the contents of the Cmap which is a vector of maps.

    code goes like this:
    Cmap< STRING, Vector< Map<std::string ,std::string >* > > resSet(w.getRs( ));

    not sure as to how to implement iterator to get the values
  • D_C
    Contributor
    • Jun 2006
    • 293

    #2
    Say you have a map m. Then you can call m.begin() and it will return an iterator pointing to the front. Similarly for m.end(). There is also m.rbegin(), which returns a reverse iterator so one may iterate from the end to the beginning, and m.rend().

    This is common for many pre-defined STL containers. There is plenty of documentation on it you can google, in fact documentation should have came with STL. Find Map.html, it has all the specifications.

    Comment

    • dna5122
      New Member
      • Jul 2006
      • 12

      #3
      That's a very ugly data structure :)

      Comment

      • stlnew
        New Member
        • Jul 2006
        • 2

        #4
        thanks..managed to do it

        Comment

        Working...