title: Passing std::vector to constructor and move semantics
body: <p>Durning the weekend I'm trying to refresh my c++ skills and learn some c++11, I've stumbled onto the following problem: I cannot force my container class to properly use move constructor:</p>
  
  <p>I have a builder class,  which is defined as follows:</p>
  
  <pre><code>class builder
  {
     ...
     container build() const
     {
       std::vector&lt;items&gt; items;
  
       //... fill up the vector
  
       return container(items); //should move the vector right? wrong!
       //return container(std::move(items)); also doesn't work
     }
  }
  </code></pre>
  
  <p>And classes item and container, defined as follows:</p>
  
  <pre><code>class container
  {
  public:
  
      container(std:vector&lt;item&gt; items)
        : items_(items) // always invokes copy constructor on vector, never move
      { }
  
      container(container&amp;&amp; rhs)
      {
         ...
      }
  
      ...
  
  private:
      std::vector&lt;item&gt; items_;
  
  }
  
  class item
  {
  public:
      //move .ctor
      item(item &amp;&amp; rhs);
      item&amp; operator=(item &amp;&amp; rhs);
  
      //copy .ctor
      item(const item&amp; rhs); //this gets called instead of move .ctor
      item&amp; operator=(const item&amp; rhs);
  
      ...
  }
  </code></pre>
  
  <p>Now my code simply uses </p>
  
  <pre><code>builder my_builder;
  ...
  auto result = my_builder.build();
  </code></pre>
  
  <p>which causes every item to be first constructed and then copied...</p>
  
  <p>How should I write following classess to not copy items? Should I just go back to using standard pointers? </p>