title: Pushing a std::array to a std::stack
body: <p>I'm doing a problem where I need to create a stack of n-dimensional coordinates. I have implemented the coordinates as type <code>std::array&lt;std::size_t, n_dims&gt;</code>, where <code>n_dims</code> is a compile-time constant.</p>
  
  <blockquote>
    <p><strong>Q</strong>: What is the best way to push a coordinate to the stack?</p>
  </blockquote>
  
  <p><strong>Possibilities:</strong></p>
  
  <ol>
  <li>Creating the array as a variable, then pushing it to the stack. This seems wasteful. A bit less bad if I use move semantics:</li>
  </ol>
  
  <pre class="lang-cpp prettyprint-override"><code>std::array&lt;std::size_t, 2&gt; my_array = {1, 3};
  my_stack.push(std::move(my_array));
  // or my_stack.emplace(...)
  </code></pre>
  
  <p>but still unnecessarily complicated.</p>
  
  <ol start="2">
  <li>Using <code>std::stack::emplace</code>. This doesn't seem to work. I think it's because <code>std::array</code> is an aggregate type. (I'd like to understand this point better -- I believe one important consequence is that aggregate types have only default and copy constructors.)</li>
  </ol>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;array&gt;
  #include &lt;stack&gt;
  
  int main() 
  {
      std::stack&lt;std::array&lt;int, 2&gt;&gt; st;
      st.emplace(1,3);      // doesn't work
      st.emplace({1,3});    // doesn't work
      st.emplace({{1,3}});  // doesn't work
  }
  </code></pre>
  
  <p>What should I do?</p>