Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's allowed to specify only part of parameters to function call(first ones) if it's possible to deduce other in compile time. Example:</p> <pre><code>template&lt;typename Ret, typename Arg&gt; Ret cast(Arg x){ return x; } cast&lt;double&gt;(5); </code></pre> <p>Actually you may even compile this code:</p> <pre><code>template&lt;int...&gt; struct Indices {}; template&lt;int J, int ...I&gt; void foo(Indices&lt;I...&gt;) {} int main(int argc, char **argv) { foo&lt;2,3&gt;(Indices&lt;3,4,5&gt;()); //ok 2,3,4,5 starts with 2,3 return 0; } </code></pre> <p>But not this one:</p> <pre><code>template&lt;int...&gt; struct Indices {}; template&lt;int J, int ...I&gt; void foo(Indices&lt;I...&gt;) {} int main(int argc, char **argv) { foo&lt;2,1&gt;(Indices&lt;3,4,5&gt;()); //no way to make x,3,4,5 start with 2,1 return 0; } </code></pre> <p>See &sect;14.1.8 part 3 of C++11 standard(N3242 draft).</p> <blockquote> <p><strong>Trailing template arguments that can be deduced (14.8.2) or obtained from default template-arguments may be omitted from the list of explicit template-arguments</strong>. A trailing template parameter pack (14.5.3) not otherwise deduced will be deduced to an empty sequence of template arguments. If all of the template arguments can be deduced, they may all be omitted; in this case, the empty template argument list &lt;> itself may also be omitted. In contexts where deduction is done and fails, or in contexts where deduction is not done, if a template argument list is specified and it, along with any default template arguments, identifies a single function template specialization, then the template-id is an lvalue for the function template specialization.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload