vector.assign() with value in sequence
<p>Is the following well-defined?</p>

<pre><code>std::vector&lt;std::string&gt; v{"test"};
v.assign(1, v.at(0));
</code></pre>

<p>If the old sequence was destroyed before the new one is constructed
the reference passed to <code>assign</code> would be invalidated and hence the
program would be ill-formed.</p>

<p>Does the standard mention this case (the
value being part of the old sequence) or something similar anywhere,
making this construct well-formed? I couldn't find anything.</p>

<p>From the copy of Dinkumware's standard library implementation shipped
with VS2010 (<code>_Assign_n</code> is what's called internally by <code>assign</code>):</p>

<pre><code>void _Assign_n(size_type _Count, const _Ty&amp; _Val)
{ // assign _Count * _Val
    _Ty _Tmp = _Val; // in case _Val is in sequence
    erase(begin(), end());
    insert(begin(), _Count, _Tmp);
}
</code></pre>

<p>The comment</p>

<blockquote>
  <p>in case _Val is in sequence</p>
</blockquote>

<p>suggests that either the
standard explicitly states that assigning an element that is part of
the current sequence is well-formed, or that Dinkumware's implementation
just tries to be smart ;) </p>

<p>Which one is it?</p>