[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: C++: no hash_map while it is there?



> > It does compile cleanly when replacing <hash_map> with <map> or with
> > <hash_map.h>.
> 
> It may be that that is the proper way to do it; I'm not familiar enough with
> STL to know. Perhaps someone on debian-gcc can comment on this?

Including <map> is certainly the wrong approach; it gives you an rb
tree, not a hash table.

I believe the right way is to do

#include <ext/hash_map>

I also believe that the comment in this header claiming that it is
internal is incorrect; the headers without .h are never internal, but
meant for the user only.

Further, I believe putting hash_map into ext was done to improve
standards compliance; this makes it clear that hash_map is not part of
standard C++, and it gives the opportunity to provide a different
<hash_map> in case hash tables are ever added to ISO C++.

Regards,
Martin



Reply to: