title: How to pass other variables as args along with std::ostream in a function in C++?
body: <p>I was working on a function which looks like so:</p>
  <pre><code>inline std::ostream&amp; mvUp(int n,std::ostream&amp; ss){
      char u[8];
      sprintf(u,&quot;\033[%dA&quot;,n);
      ss&lt;&lt;u;
      return ss;
  }
  </code></pre>
  <p>and using it like so:</p>
  <p><code>std::cout&lt;&lt;mvUp(1);</code></p>
  <p>however it shows error:</p>
  <pre><code>std::cout&lt;&lt;mvUp(1);
       |          ^_____too few args in function call
       ^_______________no operator &quot;&lt;&lt;&quot; match these operands
  </code></pre>
  <p>I also tried: <code>std::cout&lt;&lt;mvUp(1,std::cout);</code> but still not working.</p>
  <pre><code>std::cout&lt;&lt;mvUp(1);
       ^_______________no operator &quot;&lt;&lt;&quot; match these operands
  </code></pre>
  <p>now when I try making it template,</p>
  <pre><code>template &lt;int n&gt;
  inline std::ostream&amp; mvUp(std::ostream&amp; ss){
      char u[8];
      sprintf(u,&quot;\033[%dA&quot;,n);
      ss&lt;&lt;u;
      return ss;
  }
  </code></pre>
  <p>and use it: <code>std::cout&lt;&lt;mvUp&lt;1&gt;</code>, this works totally fine but the problem with this is that templates take <code>const</code> args.</p>
  <p>Not able to figure out where am I getting wrong. Also how is it working in templates when I am not passing any args?</p>