title: template function name in terms of template argument
body: <p>I've been looking for examples that relate to what my question is about and I still cannot find a solution. The closest thing I've found is </p>
  
  <p><a href="https://stackoverflow.com/questions/4697180/template-function-as-a-template-argument">Template function as a template argument</a></p>
  
  <p>I will try to post a working example in case it is needed but so far part of my code involves the
  following:</p>
  
  <pre><code>template&lt;class InterfaceType, class T&gt; 
  inline void write_info(InterfaceType&amp; interface, T&amp; t) {
      InterfaceType::write_info(interface, t);
  }
  
  template&lt;class InterfaceType, class T&gt; 
  inline void write_data(InterfaceType&amp; interface, T&amp; t) {
      InterfaceType::write_data(interface, t);
  }
  
  template&lt;class InterfaceType, class T&gt; 
  inline void write_definition(InterfaceType&amp; interface, T&amp; t) {
      InterfaceType::write_definition(interface, t);
  }
  </code></pre>
  
  <p>Notice that the templates <code>write_info</code> depend on an interface type which has a method called <code>write_info</code> (A static method). The reason this is done is because the <code>write_info</code> function can 
  be specialized later on for an specific datatype without having to redefine anything on the <code>InterfaceType</code>.</p>
  
  <p>The simple question is: Can we reduce the above code with a template that names the function as a function parameter? Keep in mind that I really want this to be possible so that I can avoid defining all those 3 function for a specialized datatype, i.e.</p>
  
  <p>Suppose that <code>foo</code> is a structure with two attributes <code>int a</code> and <code>double b</code>. Then I can specialize the above functions like this:</p>
  
  <pre><code>template&lt;class InterfaceType&gt; 
  inline void write_info(InterfaceType&amp; interface, foo&amp; t) {
      InterfaceType::write_info(interface, t.a);
      InterfaceType::write_info(interface, t.b);
  }
  
  template&lt;class InterfaceType&gt; 
  inline void write_data(InterfaceType&amp; interface, foo&amp; t) {
      InterfaceType::write_data(interface, t.a);
      InterfaceType::write_data(interface, t.b);
  }
  
  template&lt;class InterfaceType&gt; 
  inline void write_definition(InterfaceType&amp; interface, foo&amp; t) {
      InterfaceType::write_definition(interface, t.a);
      InterfaceType::write_definition(interface, t.b);
  }
  </code></pre>
  
  <p>As you can see I'm writing the same code over and over again. Here I'm assuming that the InterfaceType already has define <code>write_info</code>, <code>write_data</code> and <code>write_definition</code> for <code>int</code> and <code>double</code>. Any ideas?</p>