struct comp
{
bool operator()(const CartesianLocation& loc1, const CartesianLocation& loc2)
{
//Compare the 2 locations, return true if loc1 is less than loc2
return loc1.id < loc2.id;
}
};
std::map<CartesianLocation, std::list<RadioSignal<RadioDevice>>, comp> radioMap;
public:
void add(CartesianLocation location, std::list<RadioSignal<RadioDevice>> observedSignals) {
radioMap[location] = observedSignals;
}
在这一行radioMap[location] = observedSignals;
我收到以下错误:
没有用于调用类型&#39; const RadioMap :: comp&#39;的对象的匹配函数在这一行if(__tree_.value_comp()。key_comp()(__ k,__ right-&gt; __ value _.__ cc.first))
知道我哪里错了吗?
答案 0 :(得分:4)
您在const
的调用运算符上缺少comp
限定符:
bool operator()(const CartesianLocation& loc1,
const CartesianLocation& loc2) const { }
^^^^^