title: Vector of unique pointers error, cannot be referenced after initialization
body: <p>I'm trying to create a matrix of rectangles in SFML and have them look like a floor.  To do that, I want to use a vector of unique pointers. However, there seems to be an error I don't quite understand.</p>
  <p>After successfully initializing the vector, it is declared deleted in the very same function. When I do a similar implementation but using <code>new</code> or shared pointers, there are no problems.</p>
  <p>What is causing this error, and how can I fix it? The place of occurance is visible below:</p>
  <p>Code:</p>
  <pre><code>sf::Texture texture;
  
  texture.loadFromFile(&quot;./resources/wood.jpg&quot;);
  
  std::vector&lt;std::unique_ptr&lt;sf::Sprite&gt;&gt; floor;
  unsigned counter = 0;
  float posX = 0.f, posY = 0.f;
  for (int i = 0; i &lt; 50; i++) {
      floor.push_back(std::make_unique&lt;sf::Sprite&gt;());
      floor[i]-&gt;setTexture(texture);
      floor[i]-&gt;setTextureRect(sf::IntRect(1, 1, 100, 100));
      floor[i]-&gt;setPosition(sf::Vector2f(posX, posY));
      counter++;
      posX += 100.f;
      if (counter == 10) {
          posY += 100.f;
          posX = 0.f;
          counter = 0;
      }
  }
  
  while (window.isOpen()) {
      sf::Event eH;
  
      for (auto &amp;sprite : floor)
          window.draw(*sprite.get());
  
      while (window.pollEvent(eH)) {
          if (eH.type == sf::Event::Closed)
              window.close();
          if (eH.type == sf::Event::KeyReleased &amp;&amp; eH.key.code == sf::Keyboard::Escape)
              window.close();
          if (eH.type == sf::Event::Resized)
              glViewport(0, 0, eH.size.width, eH.size.height);
      }
  
      window.display();
      window.clear(sf::Color::Black);
  </code></pre>
  <p>Error description:</p>
  <blockquote>
  <p>'std::unique_ptr&lt;sf::Sprite,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</p>
  </blockquote>