title: Creating an uninitialized array of items which have default constructors?
body: <p>Given a class <code>Foo</code> which has some value-initializing default constructor:</p>
  
  <pre><code>class Foo {
  private:
      uint32_t x;
  
  public:
      constexpr Foo()
          : x { 3 }
      {}
      // ... and some other constructors
  };
  </code></pre>
  
  <p>I need to allocate an array of these <code>Foo</code>'s. I don't want the array's elements' default constructors to run, because later I'm going to initialize each element explicitly anyway. Something like this:</p>
  
  <pre><code>Foo foos[20000];
  
  for (int i = 0; i &lt; 20000; ++i) {
      foos[i] = init(i);
  }
  </code></pre>
  
  <p>Is there a way to obtain such an uninitialized array of <code>Foo</code>'s given that we're not allowed to change the default constructor of <code>Foo</code> into a non-initializing one?</p>
  
  <p>By the way, this is how you'd create an uninitialized array in D:</p>
  
  <pre><code>Foo[20000] foos = void;
  </code></pre>
  
  <p>...and here's the same in Rust:</p>
  
  <pre><code>let mut foos: [Foo; 20000] = unsafe { std::mem::uninitialized() };
  </code></pre>