title: How to use std::ref?
body: <p>What is the correct way to use <code>std::ref</code>? I tried following code in VS2010 and it doesn't compile:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;algorithm&gt;
  #include &lt;iostream&gt;
  #include &lt;functional&gt;
  using namespace std;
  struct IsEven
  {
      bool operator()(int n) 
      {
          if(n % 2 == 0)
          {
              evens.push_back(n);
              return false;
          }
  
          return true;
      }
  
      vector&lt;int&gt; evens;
  };
  int main(int argc, char **argv)
  {
      vector&lt;int&gt; v;
      for(int i = 0; i &lt; 10; ++i)
      {
          v.push_back(i);
      }
  
      IsEven f;
      vector&lt;int&gt;::iterator newEnd = remove_if(v.begin(), v.end(), std::ref(f));
      return 0;
  }
  </code></pre>
  
  <p>Errors:</p>
  
  <blockquote>
    <p>c:\program files (x86)\microsoft visual studio
    10.0\vc\include\xxresult(28): error C2903: 'result' : symbol is neither a class template nor a function template</p>
    
    <p>c:\program files (x86)\microsoft visual studio
    10.0\vc\include\xxresult(28): error C2143: syntax error : missing ';' before '&lt;'</p>
  </blockquote>
  
  <p>Plus some more...</p>