title: Getting the Return Type of a Templatized Object's Method
body: <p>Say that I have:</p>
  
  <pre><code>template &lt;typename T&gt;
  struct Foo {
      T&amp; func();
  };
  </code></pre>
  
  <p>And I implement a <code>Foo</code>: <code>Foo&lt;int&gt; bar</code> Now I want to get the return type of <code>bar.func()</code>. I've been trying to force <a href="http://en.cppreference.com/w/cpp/types/result_of" rel="nofollow"><code>result_of</code></a> to work with me but to no avail.</p>
  
  <p>What I'd really like is to just be able to do <code>result_of_t&lt;foo.func&gt;</code> and be done with it but I imagine it's significantly more difficult? How should I go about getting this return type?</p>
  
  <p><strong>EDIT:</strong>
  I was hoping to accomplish this without without respect to how <code>bar</code> was declared. That is to say, I want to just be able to pass <code>bar.func</code> into <code>result_of</code> or similar and gt out the return type.</p>