Part of the class with multimap and his parameters
class cl_base
{
string object_name;
cl_base* p_parent = 0;
struct o_sh {
cl_base* p_cl_base;
void (cl_base::*p_hendler) (cl_base* p_ob, string&);
};
multimap<void(cl_base::*) (string&), o_sh*> connects;
multimap<void(cl_base::*) (string&), o_sh*>::iterator it_connects;
My method with problem
void cl_base::set_connect(void(cl_base::* p_signal) (string&), cl_base* p_ob_hendler, void(cl_base:: *p_hendler) (cl_base* p_pb, string&))
{
void(cl_base::*p_key) (string&);
o_sh* p_value;
if (connects.size() > 0)
{
it_connects = connects.begin();
while (it_connects != connects.end())
{
p_key = it_connects->first;
p_value = it_connects->second;
if ((p_key) == p_signal && (p_value->p_cl_base) == p_ob_hendler && (p_value->p_hendler) == p_hendler)
return;
it_connects++;
}
}
p_value = new o_sh();
p_value->p_cl_base = p_ob_hendler;
p_value->p_hendler = p_hendler;
connects.insert( {p_signal, p_value } ); //problem here
}
/usr/include/c++/7/bits/stl_function.h:386:20: error: invalid operands of types ‘void (cl_base::* const)(std::__cxx11::basic_string&)’ and ‘void (cl_base::* const)(std::__cxx11::basic_string&)’ to binary ‘operator<’ { return __x < __y; }
==and!=, not<, whichmultimapneeds by default for its keys. You'll have to supply your own comparer as the map's third template parameter. - Etienne de Martel