stack_array in C++ Core Guidelines : <p>The C++ Core Guidelines mention something called a <a href="https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Res-stack"><code>stack_array</code></a>. Its usage looks like:</p>

<pre><code>const int n = 7;
int m = 9;

void f()
{
    std::array&lt;int, n&gt; a1;
    stack_array&lt;int&gt; a2(m);  // A stack-allocated array.
                             // The number of elements are determined
                             // at construction and fixed thereafter.
    // ...
}
</code></pre>

<p>But how can such a class be implemented? How can we dynamically determine the stack size at run time?</p>
