Unused container warning when iterating over values of a specific key in QMultiMap

49 Views Asked by At

i get an "allocating unneeded temporary container" warning when i try to iterate over the values of a specific key in a QMultiMap:

QMultiHash<QString,QString> testMap;
        
        for (auto &&value : testMap.values("Specific Key"))
        {
            
        }

Is there a better way of doin this?

1

There are 1 best solutions below

2
On

Use the snippet below to remove this warning:

QMultiHash<QString,QString> testMap;

const auto values = testMap.values("Specific Key");      
for (auto &&value : values)
{
            
}