title: Assignable reference to both lvalues and rvalues
body: <p>Suppose I have a function <code>unique_count</code> that can count the number of unique elements in any <em>unsorted</em> range:</p>
  
  <pre><code>template&lt;typename InputIt&gt;
  std::size_t unique_count(InputIt first, InputIt last)
  {
      using T = typename std::iterator_traits&lt;InputIt&gt;::value_type;
  
      std::vector&lt;/* ??? */&gt; v(first, last);
      std::sort(v.begin(), v.end());
      return std::distance(v.begin(),
                           std::unique(v.begin(), v.end()));
  }
  </code></pre>
  
  <p>I create a new <code>vector</code> because I don't want to modify the original container, but I also don't want to do unnecessary copying. The easiest solution is to make a vector of pointers, but a problem is <code>*first</code> may return either a <code>const T&amp;</code> (e.g., from a <code>vector</code>), or a <code>T</code> (e.g., from a stream).</p>
  
  <p>The <code>/* ??? */</code> part should therefore be conceptually equivalent to <code>const T&amp;</code>. We can't really do this, since <code>vector</code>s can't hold references, which are unassignable. We can't use <code>reference_wrapper&lt;const T&gt;</code> either, because it's not constructible from temporaries.</p>
  
  <p>What alternatives do I have?</p>