From: Howard Hinnant (hinnant_at_[hidden])
Date: 2002-03-06 20:43:48
On Wednesday, March 6, 2002, at 07:40 PM, David Abrahams wrote:
> [Howard, please see the end of the message]
> And a third idea: that this is what Howard's "move constructors" are
> supposed to accomplish(?). If templated "converting move constructors"
> were possible, it might help solve this problem, too (though I'm not
> sure that it addresses the issue of the built-in types).
Sorry, I haven't been following this thread. But from what I gather,
the numerics types are upset because std::vector<std::complex<double> >
constructor goes to the trouble to initialize everything to (0,0) no
I can sympathize with that gripe. I'm sure I'll draw heat for this
remark but it boils down to the decision that double() means zero
initialize instead of uninitialized. Imho that one was big a mistake,
and I see no way of backing out of it completely.
Sorry, I don't see how move constructors would solve this problem. For
pods move and copy are the same thing.
The only way I see to (partially) solve it is to add a type traits class
that says: this default constructor does nothing. But registering
std::complex with such a traits would break existing code. But assuming
such a traits, vector(size_type) could be implemented to avoid the
loop. Of course that doesn't help vector<double>. :-( Maybe
std::vector is the wrong container. Maybe std::complex is the wrong
One could fairly easily create a pod_vector that would only instantiate
for pod types, and then create a pod_complex with a well defined layout
and a trivial default constructor. The rest is down hill! :-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk