Lets say I have a class with a member variable:
std::unordered_map<KeyType, std::shared_ptr<ValueType>> myMap
and in a member function I want to do the following:
std::for_each(myMap.begin(), myMap.end(), [](std::pair<const KeyType, std::shared_ptr<ValueType>>& pair){pair.second->someMethod(); });
Is there anyway to shorten the lambda expression? I thought I could do this but it was not valid syntax:
std::for_each(myMap.begin(), myMap.end(), [](decltype(myMap::valueType)& pair){pair.second->someMethod(); });