title: Can I dynamically create instances of C++ objects in the stack?
body: <p>Just as it's possible to create a new instance of an object in the heap using <code>new Class()</code>, is it possible to create an object in the stack?</p>
  <p>I'm learning about heap vs stack.</p>
  <p>One way, in C++, is to have a static member in the cpp code:</p>
  <pre><code>static MyObject myObject;
  </code></pre>
  <p>but suppose that I have this:</p>
  <pre><code>static int emptyArray[100000];
  </code></pre>
  <p>there's sufficient RAM space, not allocated by the OS, for me to build my object. Can I use a custom allocator and build my object in a subset of this array? How would I do that?</p>