title: Adding a new instance of an array to a vector
body: <p>This is a continuation of my previous question: <a href="https://stackoverflow.com/questions/68343217/">Nested vector&lt;float&gt; and reference manipulation</a>.</p>
  <p>I got the loops and all working, but I'm trying to add new instances of arrays to a total vector.</p>
  <p>Here's one example of what I mean:</p>
  <pre class="lang-cpp prettyprint-override"><code>array&lt;float, 3&gt; monster1 = { 10.5, 8.5, 1.0 };
  // ...
  vector&lt;array&lt;float, 3&gt;*&gt; pinkys = { &amp;monster1};
  // ...
  void duplicateGhosts() {
  
      int count = 0; 
      int i = pinkys.size(); // this line and previous avoid overflow
  
      array&lt;float, 3&gt;&amp; temp = monster1; // this gets the same data, but right now it's just a reference
  
      for (auto monster : pinkys) { // for each array of floats in the pinkys vector,
          if (count &gt;= i)           // if in this instance of duplicateGhosts they've all been pushed back,
              break;                
          pinkys.push_back(&amp;temp);  // this is where I want to push_back a new instance of an array
          count++;
      }
  }
  </code></pre>
  <p>With the current code, instead of creating a new <code>monster</code>, it is adding a reference to the original <code>monster1</code> and therefore affecting its behavior.</p>