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;
我得到以下错误:
如果 (__tree_.value_comp().key_comp()(__k, __nd->__value_.__cc.first))
知道我可能错在哪里吗?
您缺少 comp
的调用运算符上的const
限定符:
bool operator()(const CartesianLocation& loc1,
const CartesianLocation& loc2) const { }
^^^^^