That has nothing to do with lambdas. The value_type of a QMap<K, V>'s iterator is simply V, not std:air<const K, V>, as with a std::map.
This means that you cannot use for_each to iterate over a QMap if you want to access the key. If you don't want to access the key, you can do this:
Code:
for_each(qmap.begin(), qmap.end(), [](const std::string& s) { ... });
Speaking of the standard map, your iteration code is very inefficient, because it copies all the strings. You want a reference there. Maybe you tried a reference and it didn't work, though? This is because the map adds const to the key.
Code:
typedef std::map<int, string> MapT;
MapT my_map;
// ...
for_each(my_map.begin(), my_map.end(), [](const MapT::value_type &test) { ... });
Meh. I wonder how long it will take GCC to implement the new for loop already.
Code:
for(const auto &test : my_map) {
...;
}