Guillaume Seguin
Thu, 04 Mar 2010 08:29:18 -0800
Great : implementing __hash__ *and* operator==() did the trick !
My implementation uses this
int hello::__hash__() const
{
//Using Duff's device version of sdbm hash func
return dbm_hash(country.c_str(), country.length());
}
bool hello::operator == (const hello &h) const {
return __hash__() == h.__hash__();
}
With the corresponding definitions for my extension
class_<hello>("hello", init<std::string>())
.def("__hash__", &hello::__hash__)
.def(self == self)
;
Thank you,
--
Guillaume
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig