title: Abstract classes and unique pointers c++ error?
body: <p>I am having issues debugging an <code>std::vector&lt;std::unique_ptr&lt;&gt;&gt;</code> with an abstract class error. The error from what I can tell is trying to using <code>vector.push_back()</code> on a <code>std::unique_ptr</code>.</p>
  
  <p><strong>Components.h</strong></p>
  
  <pre><code>namespace cr {
      class Component {
      public:
          Component();
          virtual ~Component();
          virtual void draw() = 0;
          virtual void inflate(Frame frame) = 0;
      private:
          Frame _frame;
      };
  
      class ButtonComponent : public Component {
      public:
          void draw();
          void inflate(Frame frame);
      };
  }
  </code></pre>
  
  <p><strong>Components.cpp</strong></p>
  
  <pre><code>void cr::ButtonComponent::draw()
  {
  }
  
  void cr::ButtonComponent::inflate(cr::Frame frame)
  {
  }
  
  cr::Component::Component()
  {
  }
  
  cr::Component::~Component()
  {
  }
  </code></pre>
  
  <p><strong>Window.h</strong>
  <em>part of window</em></p>
  
  <pre><code>class View {
          friend class ViewController;
      public:
          void render();
          void insert(std::unique_ptr&lt;Component&gt; component);
      protected:
          void inflate();
      private:
          Frame frame;
          std::vector&lt;std::unique_ptr&lt;Component&gt;&gt; _components;
      };
  </code></pre>
  
  <p><strong>Window.cpp</strong>
  <em>part of window</em></p>
  
  <pre><code>void cr::View::render()
  {
      for (auto&amp; c : _components) {
          c-&gt;draw();
      }
  }
  
  void cr::View::insert(std::unique_ptr&lt;Component&gt; component)
  {
      _components.push_back(component);
  }
  
  void cr::View::inflate() {
      for (auto&amp; c : _components) {
          c-&gt;inflate(frame);
      }
  }
  </code></pre>
  
  <p><strong>Error output</strong></p>
  
  <pre><code>1&gt;------ Build started: Project: test, Configuration: Debug Win32 ------
  1&gt;  RWindow.cpp
  1&gt;c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0(737): error C2280: 'std::unique_ptr&lt;cr::Component,std::default_delete&lt;_Ty&gt;&gt;::unique_ptr(const std::unique_ptr&lt;_Ty,std::default_delete&lt;_Ty&gt;&gt; &amp;)': attempting to reference a deleted function
  1&gt;          with
  1&gt;          [
  1&gt;              _Ty=cr::Component
  1&gt;          ]
  1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\memory(1435): note: see declaration of 'std::unique_ptr&lt;cr::Component,std::default_delete&lt;_Ty&gt;&gt;::unique_ptr'
  1&gt;          with
  1&gt;          [
  1&gt;              _Ty=cr::Component
  1&gt;          ]
  1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0(857): note: see reference to function template instantiation 'void std::allocator&lt;_Ty&gt;::construct&lt;_Objty,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;&amp;&gt;(_Objty *,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt; &amp;)' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              _Ty=std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;,
  1&gt;              _Objty=std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;
  1&gt;          ]
  1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0(857): note: see reference to function template instantiation 'void std::allocator&lt;_Ty&gt;::construct&lt;_Objty,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;&amp;&gt;(_Objty *,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt; &amp;)' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              _Ty=std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;,
  1&gt;              _Objty=std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;
  1&gt;          ]
  1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0(996): note: see reference to function template instantiation 'void std::allocator_traits&lt;_Alloc&gt;::construct&lt;_Ty,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;&amp;&gt;(std::allocator&lt;_Ty&gt; &amp;,_Objty *,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt; &amp;)' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              _Alloc=std::allocator&lt;std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;&gt;,
  1&gt;              _Ty=std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;,
  1&gt;              _Objty=std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;
  1&gt;          ]
  1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0(995): note: see reference to function template instantiation 'void std::allocator_traits&lt;_Alloc&gt;::construct&lt;_Ty,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;&amp;&gt;(std::allocator&lt;_Ty&gt; &amp;,_Objty *,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt; &amp;)' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              _Alloc=std::allocator&lt;std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;&gt;,
  1&gt;              _Ty=std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;,
  1&gt;              _Objty=std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;
  1&gt;          ]
  1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector(1284): note: see reference to function template instantiation 'void std::_Wrap_alloc&lt;std::allocator&lt;_Ty&gt;&gt;::construct&lt;_Ty,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;&amp;&gt;(_Ty *,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt; &amp;)' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              _Ty=std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;
  1&gt;          ]
  1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector(1283): note: see reference to function template instantiation 'void std::_Wrap_alloc&lt;std::allocator&lt;_Ty&gt;&gt;::construct&lt;_Ty,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;&amp;&gt;(_Ty *,std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt; &amp;)' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              _Ty=std::unique_ptr&lt;cr::Component,std::default_delete&lt;cr::Component&gt;&gt;
  1&gt;          ]
  1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\vector(1276): note: while compiling class template member function 'void std::vector&lt;std::unique_ptr&lt;cr::Component,std::default_delete&lt;_Ty&gt;&gt;,std::allocator&lt;std::unique_ptr&lt;_Ty,std::default_delete&lt;_Ty&gt;&gt;&gt;&gt;::push_back(const std::unique_ptr&lt;_Ty,std::default_delete&lt;_Ty&gt;&gt; &amp;)'
  1&gt;          with
  1&gt;          [
  1&gt;              _Ty=cr::Component
  1&gt;          ]
  1&gt;  c:\users\matt\documents\game development\projects\crengine\test\rwindow.cpp(14): note: see reference to function template instantiation 'void std::vector&lt;std::unique_ptr&lt;cr::Component,std::default_delete&lt;_Ty&gt;&gt;,std::allocator&lt;std::unique_ptr&lt;_Ty,std::default_delete&lt;_Ty&gt;&gt;&gt;&gt;::push_back(const std::unique_ptr&lt;_Ty,std::default_delete&lt;_Ty&gt;&gt; &amp;)' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              _Ty=cr::Component
  1&gt;          ]
  1&gt;  c:\users\matt\documents\game development\projects\crengine\test\rwindow.h(19): note: see reference to class template instantiation 'std::vector&lt;std::unique_ptr&lt;cr::Component,std::default_delete&lt;_Ty&gt;&gt;,std::allocator&lt;std::unique_ptr&lt;_Ty,std::default_delete&lt;_Ty&gt;&gt;&gt;&gt;' being compiled
  1&gt;          with
  1&gt;          [
  1&gt;              _Ty=cr::Component
  1&gt;          ]
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  
  <p><strong>Background on Project</strong></p>
  
  <p>A simple GUI which has a window, a view controller which holds multiple views. The views hold multiple components (also known as widgets). SFML and OpenGL are used during the project.</p>