title: C++11 container of borrowed unique_ptrs
body: <p>I have a vector of unique_ptrs and want to filter it into a new vector of the same type.</p>
  
  <pre><code>vector&lt;unique_ptr&lt;Thing&gt;&gt; filter_things(const vector&lt;unique_ptr&lt;Thing&gt;&gt; &amp;things) {
      vector&lt;unique_ptr&lt;Thing&gt;&gt; things;
      // i want the above line to be something like: vector&lt;const unique_ptr&lt;Thing&gt; &amp;&gt;
      // but I don't think this is valid
  
      for (const unique_ptr&lt;Thing&gt; &amp;thing : things) {
          if (check(thing)) {
              filtered.push_back(thing);  // this part shouldn't work since it
                                          // would duplicate a unique_ptr
          }
      }
  
      return filtered;
  }
  </code></pre>
  
  <p>I want the caller to maintain ownership of all the Things. I want the return value of this function to be purely read only (const), and I don't want to make copies as it is very expensive to copy a Thing.</p>
  
  <p>What is the best way to accomplish this?</p>
  
  <p>Is this possible with unique_ptrs?</p>
  
  <p>In some sense, we are creating multiple references by returning a new vector of references, so unique_ptr may not make sense. However, it is purely read only! So there should be some way to make this work. The lifetime of ``things'' is guaranteed to be larger than the filtered things.</p>
  
  <p>Note that the caller owns the parameter supplied.</p>