title: functor returning 0
body: <p>I've recently started teaching myself the standard template library. I was curious as to why the GetTotal() method in this class is returning 0?</p>
  
  <pre><code>...
  
  class Count
  {
  public:
      Count() : total(0){}
      void operator() (int val){ total += val;}
      int GetTotal() { return total;}
  private:
      int total;
  };
  
  void main()
  {
      set&lt;int&gt; s;
      Count c;
      for(int i = 0; i &lt; 10; i++) s.insert(i);
      for_each(s.begin(), s.end(), c);
      cout &lt;&lt; c.GetTotal() &lt;&lt; endl;
  }
  </code></pre>