title: Invoke std::function in an std::for_each
body: <p>I have in essence the following code:</p>
  
  <pre><code>typedef std::function&lt;void ()&gt; fnGlobalChangeEvent;
  typedef std::vector&lt;fnGlobalChangeEvent&gt; GlobalTriggers;
  
  inline void ExecuteGlobal(fnGlobalChangeEvent ev)
  {
      ev();
  }
  
  GlobalTriggers triggers;
  std::for_each(triggers.begin(), triggers.end(), std::bind(&amp;ExecuteGlobal, _1));
  </code></pre>
  
  <p>The use of ExecuteGlobal feels totally redundant here, but I can't find the right syntax to drop out the call.</p>
  
  <pre><code>std::for_each(triggers.begin(), triggers.end(), ExecuteGlobal(_1));
  std::for_each(triggers.begin(), triggers.end(), std::bind(_1));
  </code></pre>
  
  <p>Both fail to compile.</p>
  
  <p>There is also a more complex case:</p>
  
  <pre><code>typedef std::function&lt;void (Zot&amp;)&gt; fnChangeEvent;
  typedef std::vector&lt;fnChangeEvent&gt; Triggers;
  
  inline void Execute(fnChangeEvent ev, Zot&amp; zot)
  {
      ev(zot);
  }
  
  Triggers triggers;
  std::for_each(triggers.begin(), triggers.end(), std::bind(&amp;Execute, _1, zot));
  </code></pre>
  
  <p>Is it possible to do without the helper functions in these cases?</p>