Reputation: 668
Is it possible to iterate through qmap when key and value is a pointer with foreach?
I always get the error: decltype cannot resolve address of overloaded function
template <typename T, typename T1>
bool func(T1* subject, QMap<T*,T1*>* map)
{
//...
foreach (T1* a, map->values) {
}
thank you for helping me
Upvotes: 4
Views: 11619
Reputation: 4367
As Mike pointed out, you need to call map->values()
before foreach
would even work normally.
foreach
operates on references, and QMap::values()
returns a list of them. This would work:
foreach (T1 a, map->values()) {
if (a == *subject)
...
}
Upvotes: 4