title: Why can I not specify the constructor when newing an array?
body: <p><strong>Updates:</strong></p>
  
  <p>The link above and the answers below didn't answer <strong>WHY</strong> this feature is not standardized. That is just what makes me wonder. Please consider the <strong>performance issue</strong> between <code>std::vector&lt;A&gt; arr(8, 7);</code> and <code>new A[8](7);</code>:</p>
  
  <p>If we use <code>std::vector&lt;A&gt; arr(8, 7);</code> it may (not must) be implemented as follows:    </p>
  
  <pre><code>this-&gt;internal_buf = new A[8]; // Call default constructor A() 8 times!
  for (auto i = 0; i &lt; 8; ++i)
  {
      this-&gt;internal_buf[i] = A(7); // Call constructor A(7) 8 times AGAIN!!!
  }
  </code></pre>
  
  <p>If C++ supports <code>new A[8](7);</code> It can be implemented as follows:</p>
  
  <pre><code>A* arr = (A*)malloc(sizeof(A) * 8 + extra_size);
  
  for (auto i = 0; i &lt; 8; ++i)
  {
      new (&amp;arr[i]) A(7); // Call constructor A(7) 8 times ONLY.
  }
  </code></pre>
  
  <p>Compare the two methods, it is obvious that <code>new A[8](7);</code> is <strong>FASTER</strong> than <code>std::vector&lt;A&gt; arr(8, 7);</code></p>
  
  <p>Besides, I also feel <code>new A[8](7);</code> is more succinct and more expressive than <code>std::vector&lt;A&gt; arr(8, 7);</code></p>
  
  <p><strong>Anyway, I think C++ should give programmers another alternative tool such as this feature. Because one of the C++ philosophies is "Give you as many tools as possible, but you don't have to pay for what you don't need."</strong></p>
  
  <p><strong>The following is the original post:</strong></p>
  
  <pre><code>struct A
  {
      int n;
      A() : n() {}
      A(int n) : n(n) {}
  };
  
  int main()
  {
      new A[8];    // OK
      new A[8]();  // OK
      new A[8](7); // Error
  }
  </code></pre>
  
  <p>Why can I not specify the constructor when newing an array?</p>
  
  <p>Why does the C++ standard not support such a handy feature? <strong>What's the rationale?</strong></p>