没有匹配的函数调用Std::find
No matching function to call Std::find?
我正在尝试:
std::find(images_map.begin(), images_map.end(), current_rgb));
地点:
QRgb current_rgb;
QMap<QRgb, MI*> images_map;
但是我得到:
error: no matching function for call to 'find(QMap<unsigned int, MI*>::iterator, QMap<unsigned int, MI*>::iterator, QRgb&)
原因是find
期望容器的value_type
与传递给find
的搜索对象类型相同。您只传递了键,而不是键和值。
相反,在容器本身上使用find
方法(它也具有对数时间复杂度而不是线性时间复杂度的好处)。
请使用QMap::find()
方法。
相关文章:
- std::find,返回所有找到的值的替代方法,而不仅仅是存在重复的向量的第一个值
- 为什么在向量上使用 std::find() 时会出现错误?
- 使用 std::find 时没有匹配的函数调用错误
- STL std::find() C++
- 如何将 std::find() 与 2d std: 数组一起使用?
- 如果迭代器没有因插入而无效,则使用std::find和C::insert()是线程安全的
- 未按值排序的std::find和std::any_of
- 在libc++和libstdc++之间的std::map上使用std::find时的实现差异
- 有没有办法在Cython中导入std::find find_if等?
- 由 std::find() 返回的迭代器不可取消引用
- C++ std::find() 寻址返回向量的类函数时的意外行为
- 在 std::find 中使用来自不同命名空间的运算符
- 使用 std::find 和用户提供的谓词 - 自制的 find() 重载
- 如何使用 std::find 找到元素的所有位置?
- 使用带有反向迭代器的std :: find()
- C++ STL: std::find with std::map
- std::find是否隐式修复无效参数
- 如何在 std::vector 内的自定义对象上使用 std::find
- std::find on empty vector 是否会导致未定义的行为
- 使用 std::find 在向量中定位随机生成的数字