Original Post
Hi,
I just started using STL. Developing on VC++ and using STL from stlport.org, I get some errors using hash_map. Any help would be appreciated.
Trying to compile the above code, I get the following errors:
The errors occur on this method:
#include <hash_map>
using namespace std;
class element
{
public:
element()
{
}
int dummy;
bool operator==(const element &ref) const
{
return true;
}
};
class elementComp
{
public:
bool operator()(element &l, element &r) const
{
return true;
}
};
typedef hash_map<element, int, elementComp> Map;
void main(void)
{
Map mymap;
element e;
mymap.insert(Map::value_type(e, 1));
}
c:\program files\microsoft visual studio\stlport\stlport-4.5.3\stlport\stl\_hashtable.h(557) : error C2660: ''()'' : function does not take 1 parameters
c:\program files\microsoft visual studio\stlport\stlport-4.5.3\stlport\stl\_hashtable.h(556) : while compiling class-template member function ''unsigned int __thiscall _STL::hashtable<struct _STL::pair<class element const ,int>,class element,
class elementComp,struct _STL::_Select1st<struct _STL::pair<class element const ,int> >,struct _STL::equal_to<class element>,class _STL::allocator<struct _STL::pair<class element const ,int> > >::_M_bkt_num_key(const class element &,unsigned int) co
nst''
c:\program files\microsoft visual studio\stlport\stlport-4.5.3\stlport\stl\_hashtable.h(557) : error C2064: term does not evaluate to a function
c:\program files\microsoft visual studio\stlport\stlport-4.5.3\stlport\stl\_hashtable.h(556) : while compiling class-template member function ''unsigned int __thiscall _STL::hashtable<struct _STL::pair<class element const ,int>,class element,
class elementComp,struct _STL::_Select1st<struct _STL::pair<class element const ,int> >,struct _STL::equal_to<class element>,class _STL::allocator<struct _STL::pair<class element const ,int> > >::_M_bkt_num_key(const class element &,unsigned int) co
nst''
size_type _M_bkt_num_key(const key_type& __key, size_t __n) const
{
return _M_hash(__key) % __n;
}