[英]No matching function for call to object of type 'const RadioMap::comp'
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;
}
On this line radioMap[location] = observedSignals;
在这一行上, radioMap[location] = observedSignals;
I am getting below error: 我得到以下错误:
No matching function for call to object of type 'const RadioMap::comp' on this line if (__tree_.value_comp().key_comp()(__k, __nd->__value_.__cc.first)) 如果(__tree_.value_comp()。key_comp()(__ k,__nd-> __ value _.__ cc.first))在此行上没有用于调用'const RadioMap :: comp'类型对象的匹配函数
Any idea where I may be wrong? 知道我哪里错了吗?
You are missing the const
qualifier on the call operator of comp
: 您缺少comp
的调用运算符上的const
限定词:
bool operator()(const CartesianLocation& loc1,
const CartesianLocation& loc2) const { }
^^^^^
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.