开发者

No matching function to call Std::find?

I am trying to do:

std::find(images_map.begin(), images_map.end(), current_rgb));

where:

QRgb current_rgb;
QMap<QRgb, MI*>开发者_Python百科 images_map;

but I get:

error: no matching function for call to 'find(QMap<unsigned int, MI*>::iterator, QMap<unsigned int, MI*>::iterator, QRgb&)


The reason is because find expects the value_type of the container to be the same as the searchee type passed in to find. You passed in just the key, not the key and value.

Instead, use the find method on the container itself (which also has the benefit of being logarithmic instead of linear time complexity).


Use the QMap::find() method instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜