How are std::arrays of smart pointers initialized? : <p>I currently try to initialize the following array, Spot is a class that is defined elsewhere:</p>

<pre><code>static const int WIDTH = 7;
static const int HEIGHT = 6;
std::array&lt;std::array&lt;std::unique_ptr&lt;Spot&gt;, WIDTH&gt;, HEIGHT&gt; field;
</code></pre>

<p>When trying to initialize it:</p>

<pre><code>    for (int i = 0; i &lt; HEIGHT; i++) {
    for (int j = 0; j &lt; WIDTH; j++) { 
        field.at(i).at(j) = std::make_unique&lt;Spot&gt;(new Spot());
    }
}
</code></pre>

<p>it states that Spot* cannot be converted to const Spot &amp;, which makes pretty much sense.</p>

<p>Google is not really helpful here, as the questions either deal with </p>

<pre><code>std::unique_ptr&lt;T&gt; [] or
std::uniqe_ptr&lt;std::array&lt;T&gt;&gt; but not with 
std::array&lt;std::unique_ptr&lt;T&gt;&gt; 
</code></pre>

<p>So, how do you achieve that? Is that even a thing? Or are you not supposed to use std::arrays with smart pointers at all?</p>
