Doing so strikes me as a waste of time. Consider
std::complex<double> *a = new std::complex<double>[1<<28];
This could be near-instantaneous and only grab pages once they're used, except it isn't.
It appears I'm not the only one bothered by this:
http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2011/01/msg00124.html
GCC's libstdc++ (4.6.3) even gloats with this fact:
/// Default constructor. First parameter is x, second parameter is y.
/// Unspecified parameters default to 0.
_GLIBCXX_CONSTEXPR complex(const _Tp& __r = _Tp(), const _Tp& __i = _Tp())
: _M_real(__r), _M_imag(__i) { }
Worse, since the C++ standard doesn't specify a default constructor, this behavior may even be required. (Is this true?)
std::vector<std::complex<double> > a;followed bya.reserve(1<<28);– James Custer Apr 21 '12 at 00:08