This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: STL question
- To: Alexander Samoilov <spike at Gambit dot Msk dot SU>
- Subject: Re: STL question
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 26 Sep 1998 01:10:37 +-300
- Cc: egcs at cygnus dot com
- References: <Pine.GSO.3.95.980924122717.11359A-100000@Madrid>
Alexander Samoilov <spike@Gambit.Msk.SU> writes:
> typedef hash_map<char* const, int, hash<char*>, eqstr> hmap;
> int main() { hmap ins_diff;
> insert_iterator<hmap> ii1(ins_diff,ins_diff.begin());
Unlike map, hash_map does not support insert(pos,x), so insert
iterators do not work on it :-(
Instead, you may want to replace ii1 with:
bind1st(mem_fun(insert_meth), &ins_diff)
given:
pair<hmap::iterator,bool> (hmap::*insert_meth)(const hmap::value_type&)
= &hmap::insert;
Perhaps insert iterators should be specialized for hash maps...
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil