hash_map problem

Tabakovic Arnes arnes.tabakovic@sbi.ch
Tue Sep 3 02:23:00 GMT 2002


Hi everybody!!! Ok I solved the problem!! I hope so..... What I did was to
define my own hash function before including the header
"backward/hash_map.h", NOT AFTER! And it worked! Yes the compilation shows
no more errors :)
I hope this can help anybody needing an answer to my problem :)



I WROTE:
//////////
Hi,
I have a problem using the hash_map class. Basically I can use it as a
inherited class, I can use its constructor and initialize it. Nevertheless
when I try using the "find" function or "insert" function (even maybe other
ones...) I get an compilation error that is given below. I have made my self
hash function containing the operator() : 
class hashInstanz
{
	public:
		unsigned int operator() (const instanz_t& key) const;
};
Can anybody please help me to deal with that? I will be graceful with any
help :) 

In member function `size_t 
   std::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, 
   _Alloc>::_M_bkt_num_key(const _Key&, unsigned int) const [with _Val = 
   std::pair<instanz_t* const, BuGeschaeftsvorfall*>, _Key = instanz_t*, 
   _HashFcn = hashInstanz, _ExtractKey =
std::_Select1st<std::pair<instanz_t* 
   const, BuGeschaeftsvorfall*> >, _EqualKey = std::equal_to<instanz_t*>, 
   _Alloc = std::allocator<BuGeschaeftsvorfall*>]':
/usr/local/include/g++-v3/ext/stl_hashtable.h:497:   instantiated from
`size_t std::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey,
_Alloc>::_M_bkt_num_key(const _Key&) const [with _Val = std::pair<instanz_t*
const, BuGeschaeftsvorfall*>, _Key = instanz_t*, _HashFcn = hashInstanz,
_ExtractKey = std::_Select1st<std::pair<instanz_t* const,
BuGeschaeftsvorfall*> >, _EqualKey = std::equal_to<instanz_t*>, _Alloc =
std::allocator<BuGeschaeftsvorfall*>]'
/usr/local/include/g++-v3/ext/stl_hashtable.h:447:   instantiated from
`std::_Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey,
_EqualKey, _Alloc> std::hashtable<_Val, _Key, _HashFcn, _ExtractKey,
_EqualKey, _Alloc>::find(const _Key&) const [with _Val =
std::pair<instanz_t* const, BuGeschaeftsvorfall*>, _Key = instanz_t*,
_HashFcn = hashInstanz, _ExtractKey = std::_Select1st<std::pair<instanz_t*
const, BuGeschaeftsvorfall*> >, _EqualKey = std::equal_to<instanz_t*>,
_Alloc = std::allocator<BuGeschaeftsvorfall*>]'
/usr/local/include/g++-v3/ext/hash_map:170:   instantiated from `typename
std::hashtable<std::pair<const _Key, _Tp>, _Key, _HashFcn,
std::_Select1st<std::pair<const _Key, _Tp> >, _EqualKey,
_Alloc>::const_iterator std::hash_map<_Key, _Tp, _HashFcn, _EqualKey,
_Alloc>::find(typename std::hashtable<std::pair<const _Key, _Tp>, _Key,
_HashFcn, std::_Select1st<std::pair<const _Key, _Tp> >, _EqualKey,
_Alloc>::key_type&) const [with _Key = instanz_t*, _Tp =
BuGeschaeftsvorfall*, _HashFcn = hashInstanz, _EqualKey =
std::equal_to<instanz_t*>, _Alloc = std::allocator<BuGeschaeftsvorfall*>]'
/export/home/ata/projects/belegprozessor/vvevbu/ux1/cpr/src/bugescha.cc:319:
instantiated from here
/usr/local/include/g++-v3/ext/stl_hashtable.h:507: no match for call to
`(const 
   hashInstanz) (instanz_t* const&)'
/export/home/ata/projects/belegprozessor/vvevbu/ux1/cpr/src/bugescha.cc:335:
candidates
   are: unsigned int hashInstanz::operator()(const instanz_t&) const




////////



More information about the Gcc-patches mailing list