Topic: hash_map lookup


Author: johna@daldd.sc.ti.com (John Apostol)
Date: 1998/10/15
Raw View

I looking for a method to store (key,value) pairs
in a hash_map structure and be able to search
for entries based on key *and* some attribute
of value.

For example, I can currently do

  hash_map<const char*, data*, hash<const char*>, equate_str> Map;
  ...
  data* p = new data(...);
  p->id = id++;
  p->name=name;
  Map.insert( make_pair( name , p ) );

  ...
  hash_map<const char*, data*, hash<const char*>, equate_str>::const_iterator i
       = Map.find( name );

What I would like to do is

 ...

   i = Map.find( name, id );

Any thoughts?




[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]