title: How to get a forwarding function to call a base template function that is declared after the forwarding function
body: <p>I have a case where I need to have a forwarding function defined before a template base function is defined/declared.  However, if I call the forwarding function (<code>fwd</code>) that in turn calls the base function <code>test</code>, it says that the base template function is not visible (see the code below).  However, if <code>test</code> is called directly, everything works.  </p>
  
  <p>So my question is this, is it possible to have the forwarding function make a call to a base template function that is defined later in the compilation unit (before it is used but after the forwarding function)?  If not, do I have any options to work around this?  I would like to avoid a forward declaration before <code>fwd</code> as that would make use of the library I am developing harder.  I think if I could force <code>fwd</code> to be inline it would solve the problem but I have no way of doing that unless a macro is used.  </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  template&lt;typename T, std::enable_if_t&lt;std::is_scalar&lt;T&gt;::value, int&gt; = 0&gt;
  void test(const T&amp; t)
  {
    std::cout &lt;&lt; "Scalar"  &lt;&lt; std::endl;
  }
  
  template&lt;typename T&gt;
  void fwd(T&amp;&amp; t)
  {
    test(std::forward&lt;T&gt;(t));
  }
  
  template&lt;typename T&gt;
  void test(const std::vector&lt;std::vector&lt;T&gt;&gt;&amp; t)
  {
    std::cout &lt;&lt; "vector vector of T" &lt;&lt; std::endl;
  }
  
  int main(int argc, const char * argv[]) {
  
    test(1);  //OK, prints Scalar
    fwd(1);   //OK, prints Scalar
  
    test(std::vector&lt;std::vector&lt;int&gt;&gt;()); //OK, prints vector vector of T
  
    // Causes compile error: Call to function 'test' that is neither visible in the template definition
    // nor found by argument dependent lookup
    fwd(std::vector&lt;std::vector&lt;int&gt;&gt;());
  
    return 0;
  }
  </code></pre>