title: A question about for_each in vector of c++
body: <p>I have a question about the for_each in vector, the code is following:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;algorithm&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  
  struct myclass {
    void operator() (int i) {cout &lt;&lt; " " &lt;&lt; i;}
  } myobject;
  
  int main () {
    vector&lt;int&gt; myvector(3,4);
  
    cout &lt;&lt; "\nmyvector contains:";
    for_each (myvector.begin(), myvector.end(), myobject);
  
    cout &lt;&lt; endl;
  
    return 0;
  }
  </code></pre>
  
  <p>should the third argument of for_each() be a function name?
  if we pass the name of the struct, how does this works?</p>