title: How to write a helper type for result_of in C++11
body: <pre><code>template&lt;typename F,typename...X&gt;
  using Result_of = typename result_of&lt;F(X...)&gt;::type;
  
  int ff(int){return 2;}
  typedef bool(*PF)(int);
  auto fx = [](char ch){return tolower(ch);};
  Result_of&lt;decltype(&amp;ff)()&gt; r1 = 7;
  Result_of&lt;PF(int)&gt; r2 = 2;
  Result_of&lt;decltype(fx)(char)&gt; r5 = "a";
  </code></pre>
  
  <p>When I compile with gcc, I get the following error:</p>
  
  <pre><code>main.cpp: In substitution of 'template&lt;class F, class ... X&gt; using Result_of = typename std::result_of&lt;_Functor(_ArgTypes ...)&gt;::type [with F = int (*())(int); X = {}]':
  main.cpp:17:30:   required from here
  main.cpp:6:57: error: function returning a function
   using Result_of = typename std::result_of&lt;F(X...)&gt;::type;
                                                           ^
  </code></pre>
  
  <p>Why am I getting this error and how do I fix it?</p>