title: Declaring static auto function pointers in traits template
body: <p>I have a couple of functions for different data types that I want to use in a template depending on the data type of the template parameter. I declared a helper template struct <code>traits</code> and specialized it for the corresponding data types. </p>
  
  <p>My question is: is it possible to avoid writing the exact function signatures in these specializations? Additionally, is it possible to avoid defining these functions outside of the template declaration and still have them <code>static</code>? </p>
  
  <p>The very simplified example of what I want to do is below. The syntax that I would <em>like</em> to use is commented out, but it clearly doesn't compile.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int f() { return 1; }
  double g() { return 2.3; }
  
  template&lt;typename T&gt;
  struct traits;
  
  template&lt;&gt;
  struct traits&lt;int&gt; {
      // static auto func = f;
      int(*func)() = f;
  };
  
  template&lt;&gt;
  struct traits&lt;double&gt; {
      // static auto func = g;
      double(*func)() = g;
  };
  
  template&lt;typename T&gt;
  struct traits_user {
      void output() {
          // std::cout &lt;&lt; traits&lt;T&gt;::func() &lt;&lt; " ";
          std::cout &lt;&lt; traits&lt;T&gt;().func() &lt;&lt; " ";
      }
  };
  
  
  int main()
  {
      traits_user&lt;int&gt;().output();
      traits_user&lt;double&gt;().output();
  }
  </code></pre>
  
  <p><strong>Edit</strong> 
  While answer by @RSahu is actually perfect, I cannot use it because I'm stuck with VS2013 for some time more. A solution suitable for VS2013 would be very welcome.</p>