title: Array initialization of objects without operator =, copy constructor or default constructor and run-time arguments
body: <h2>Disclaimer</h2>
  <p>I'm trying to allocate an array of objects that are neither copy constructible, assignable nor has a default constructor. The objects have arguments that are determined at run time. I know that you can solve this problem by having an array of pointers or cleverly using placement new but I'm more interested in if this is possible to do cleanly with C++11 (1y) magic. <strong>So please, this is purely of theoretical interest so avoid trying to solve &quot;my problem&quot; by offering a work around.</strong></p>
  <h2>The code...</h2>
  <p>...So the question is: Is there a way to make the following work in C++11 or C++14:</p>
  <pre><code>class X{
  public:
    explicit X(int a){...}
    X(const X&amp;) = delete;
    void operator = (const X&amp;) = delete;
  private:
    ...
  };
  
  class Y{
  public:
    Y(const std::vector&lt;int&gt;&amp; args) {
      x = new X[]{args};
    }
    ~Y(){
      delete [] x;
    }
  private:
    X* x;
  };
  </code></pre>
  <h2>Criteria</h2>
  <p>Specifically I'm looking for a solution/construct that meets the following criteria:</p>
  <ul>
  <li>X is not copy constructible.</li>
  <li>X is not assignable.</li>
  <li>X does not have a default no-argument constructor (construction has intended side-effects).</li>
  <li>The arguments to X's constructor are not known until run time.</li>
  <li>All instances of X must be laid out contiguously in memory.</li>
  <li>X must be properly destructed when the array is deleted from it's base pointer (or if an intermediate class is used, when the intermediate object is destructed). This rules out array of pointers and naivë use of placement new.</li>
  </ul>
  <h2>Edit / Addendum</h2>
  <p>I forgot to mention that move constructor is not available. In the actual case at hand, <code>X</code> spawns a worker thread and is executing in the context of <code>this</code> of the initially constructed object, any attempt to use a move constructor will corrupt the state of the executing thread.</p>