title: Pass a template function with their template argument as an argument of another function in C++
body: <p>I have a project, in there I have to pass a function and their template argument as an argument of another function. Do you guy know how to do it.</p>
  
  <p>I would like to add more detail about my code:</p>
  
  <pre><code>template &lt;typename T, typename functional&gt;
  void implement(int ind, Element&lt;T&gt; *ele, functional f) {
  
  f(&amp;ele[ind]);
  return;
  }
  template &lt;typename T&gt;
  void INIT_ADV_1D(Element&lt;T&gt; *ele) {
  
      Vect1D&lt;T&gt; *PHI = &amp;ele-&gt;U[1];
      Vect1D&lt;T&gt; *U = &amp;ele-&gt;U[2];
      for (int i = 0; i &lt; ele-&gt;order + 1; i++) {
          U[i] = 1.e0;
          if (ele-&gt;xk(i) &lt;= 0.5e0)
              PHI[0](i) = 1.e0;
          else
              PHI[0](i) = 0.e0;
      }
  }
  main (){
  implement(0, model.Ele, INIT_ADV_1D);
  }
  </code></pre>
  
  <p>I already searched in our forum about this topic, but They just guide to make a function as an argument of other function which not suite my target.</p>
  
  <p>Thank you.</p>