title: How to use std::for_each on a map element method with input?
body: <p>I have:<br></p>
  
  <pre><code>struct Mystruct
  {
      void Update(float Delta);
  }
  
  typedef std::map&lt;int, Mystruct*&gt; TheMap;
  typedef TheMap::iterator         TheMapIt;
  
  TheMap Container;
  </code></pre>
  
  <p>and wants to do:</p>
  
  <pre><code>for(TheMapIt It = Container.begin(), Ite = Container.end(); It != Ite; ++It)
  {
      It-&gt;second-&gt;Update(Delta);
  }
  </code></pre>
  
  <p>using <code>std::for_each</code>, how to do this?</p>
  
  <p>I think I can declare function like:</p>
  
  <pre><code>void Do(const std::pair&lt;int, Mystruct*&gt; Elem)
  {
      Elem-&gt;Update(/*problem!*/); ---&gt; How to pass Delta in?
  }
  </code></pre>
  
  <p>Or make another struct:</p>
  
  <pre><code>struct Doer
  {
      Doer(float Delta): d(Delta) {}
  
      void operator(std::pair&lt;int, Mystruct*&gt; Elem)
      {
          Elem-&gt;Update(d);
      }
  }
  </code></pre>
  
  <p>But this requires a new struct.</p>
  
  <p>What I wants to achieve is using plain <code>std::for_each</code> with something like <code>std::bind_1st</code>, <code>std::mem_fun</code> like the way with <code>std::vector</code>, is it possible?</p>
  
  <p>Please consider using <code>std</code> way before using <code>boost</code>, thanks!</p>
  
  <p>I've referenced this but it doesnt metion about member function with input...
  <a href="https://stackoverflow.com/questions/2463528/how-would-i-use-for-each-to-delete-every-value-in-an-stl-map">How would I use for_each to delete every value in an STL map?</a></p>