title: C++ array wrapper
body: <p>I've wanted a wrapper around arrays, such, it would be stored at the stack - to be not concerned about memory releasing - be initializable via brace lists, and possibly be substitutable in any place of an ordinary array. Then, I've produced the following code. And now am wondering, have I missed something. -- So - is it what I've wanted?</p>
  
  <pre class="lang-cpp prettyprint-override"><code>template&lt;class T, size_t size&gt;
  struct Array
  {
      T body[size];
  
      operator T* () { return body; }
  };
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>I might be imprecise. The wrapper is only for constructional purpose. It shall be used for constructing arrays from brace lists, when being in an initialization list (primarily). Like</p>
  
  <pre><code>class A {
      protected: A(int array[])
      ...
  
  class B : public A {
      public: B() : 
          A( (Array&lt;int, 2&gt;) {{ 1, 2 }} )
          ...
  </code></pre>
  
  <p>There was a proposition of a <code>const</code> version of the casting operator. - I've been considering this, but am not sure, is it really needed. While casting to <code>const T[]</code> is done implicitly through the existing operator, and a constant array can be defined by giving <code>T = const ...</code>, is there still a reason?</p>