title: Why isn't std::result_of<int(int)>::type valid?
body: <p>I have read the following related questions:</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/11470802/stdresult-of-simple-function">std::result_of simple function</a></li>
  <li><a href="https://stackoverflow.com/questions/2763824/decltype-result-of-or-typeof">decltype, result_of, or typeof?</a></li>
  </ol>
  
  <p>and <a href="http://en.cppreference.com/w/cpp/types/result_of" rel="noreferrer">the page on <code>std::result_of</code> at cppreference.com</a>.</p>
  
  <p>All of them seem to indicate that I should be able to use:</p>
  
  <pre><code> std::result_of&lt;int(int)&gt;::type v1 = 10;
  </code></pre>
  
  <p>However, when I tried building the following program using g++ 4.9.2</p>
  
  <pre><code>#include &lt;type_traits&gt;
  
  int foo()
  {
     return 0;
  }
  
  int main()
  {
      std::result_of&lt;int(int)&gt;::type v1 = 10;           // LINE A
      std::result_of&lt;decltype(foo)&gt;::type v2 = 20;      // LINE B
      return 0;
  }
  </code></pre>
  
  <p>I get error messages for "LINE A" and "LINE B". The error messages are:</p>
  
  <pre class="lang-none prettyprint-override"><code>socc.cc: In function ‘int main()’:
  socc.cc:10:5: error: ‘type’ is not a member of ‘std::result_of&lt;int(int)&gt;’
       std::result_of&lt;int(int)&gt;::type v1 = 10;
       ^
  socc.cc:11:5: error: ‘type’ is not a member of ‘std::result_of&lt;int()&gt;’
       std::result_of&lt;decltype(foo)&gt;::type v2 = 20;
       ^
  </code></pre>
  
  <p>The command I used to compile:</p>
  
  <pre class="lang-none prettyprint-override"><code>g++ -std=c++11 -Wall    socc.cc   -o socc
  </code></pre>
  
  <p>FWIW, using</p>
  
  <pre><code> typename std::result_of&lt;int(int)&gt;::type v1 = 10;
   typename std::result_of&lt;decltype(foo)&gt;::type v2 = 20;
  </code></pre>
  
  <p>didn't make a difference.</p>
  
  <p>It seems that I am failing to understand how <code>result_of</code> is supposed to be used.</p>
  
  <p>Can you explain why I am getting the compiler errors?</p>