title: Uninitialized std::complex constructor when using 'new'
body: <p>In profiling my program I realized that 10% of the code is spent in a stupid <code>std::complex&lt;double&gt;()</code> constructor, using <code>new std::complex&lt;double&gt;[size_of_array]</code>.</p>
  
  <p>I have searched through the web and the default constructor for <code>std::complex</code> seems to take as real and imaginary parts the values double(). Since C++ does not initialize double numbers, I wonder why g++ bothers to initialize <code>std::complex</code> with zeros, and whether I could work around this through the whole program in some way (*)</p>
  
  <p>(*) right now I have to special case the functions that create arrays of complex numbers to allocate uninitialized arrays of doubles and recast them as complex.</p>
  
  <p>Edit: as pointed below, it was an oversight on my side. The default constructor has empty constructors for the real and imaginary part (<a href="http://en.cppreference.com/w/cpp/numeric/complex/complex" rel="noreferrer">http://en.cppreference.com/w/cpp/numeric/complex/complex</a>)</p>
  
  <pre><code> complex( const T&amp; re = T(), const T&amp; im = T() );
  </code></pre>
  
  <p>but the specification then introduces special cases for double</p>
  
  <pre><code> complex(double re = 0.0, double im = 0.0);
  </code></pre>
  
  <p>It is this special case that introduces all the overhead, as it bypasses the actual default constructor of 'double' which does nothing (same as for int, long, float, etc).</p>