title: Begin of output container default value in a function
body: <p>I have function that has the following deceleration:</p>
  
  <pre><code>template&lt;class Tinput_iterator, class Toutput_iterator&gt;
  int foo(const Tinput_iterator&amp; begin_input, const Tinput_iterator&amp; end_input, Toutput_iterator&amp; begin_output);
  </code></pre>
  
  <p>The <code>begin</code> and <code>end</code> of the data container(<code>begin_input</code> &amp; <code>end_input</code>) are mandatory. However, the <code>begin</code> of the output container(<code>end_input</code>) is optional.</p>
  
  <p>What should I put instead of XXX in this case:</p>
  
  <pre><code>template&lt;class Tinput_iterator, class Toutput_iterator&gt;
  int foo(const Tinput_iterator&amp; begin_input, const Tinput_iterator&amp; end_input, Toutput_iterator&amp; begin_output = XXX);
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>if <code>begin_output</code> was passed like this for example:</p>
  
  <pre><code>std::vector&lt;int&gt; bar(data.size());
  auto result=foo(begin(data),end(data),begin(bar));
  </code></pre>
  
  <p><code>result</code> will contain an <code>integer</code></p>
  
  <p><code>bar</code> will contain 100 values of <code>integers</code>.</p>
  
  <p>if it was called like this:</p>
  
  <pre><code>auto result=foo(begin(data),end(data)/*,begin(bar)*/);
  </code></pre>
  
  <p><code>result</code> will contain an <code>integer</code> (same as above) </p>
  
  <p>of course there is no <code>bar</code> and nothing will be stored </p>