
Christopher Kormanyos wrote:
Did you also notice in my other post that my suggested correction was, in fact, wrong? I am terribly sorry about that. You actually need this: explicit complex(const T& re = T(), const T& im = T());
Geez! How many times can I get it wrong? I'm making a fool of myself here.
It's non-explicit and the default params are not zero, but rather the default ctor of the template type.
complex(const T& re = T(), const T& im = T());
It's time for me to take a break...
Best regards, Chris.
Do I understand correctly that the default contructor does not set real and imag parts to zero? Hurray!! I consider it a serious defect in std::complex that it's default constructor performs non-trivial work. Often large arrays of complex need to be constructed in high-performance computing applications.