How to use std::for_each on a map element method with input?
问题 I have: struct Mystruct { void Update(float Delta); } typedef std::map<int, Mystruct*> TheMap; typedef TheMap::iterator TheMapIt; TheMap Container; and wants to do: for(TheMapIt It = Container.begin(), Ite = Container.end(); It != Ite; ++It) { It->second->Update(Delta); } using std::for_each , how to do this? I think I can declare function like: void Do(const std::pair<int, Mystruct*> Elem) { Elem->Update(/*problem!*/); ---> How to pass Delta in? } Or make another struct: struct Doer { Doer