std::valarray< double > myArray(3)
produces a valarray
of length 3, initialized to zero.
std::valarray< double > myArray(1,3)
produces a valarray
of length 3, initialized to one.
std::valarray< double > myArray(0,3)
produces error: call to constructor of 'std::valarray<double>' is ambiguous
.
I can of course use myArray(3)
and add a comment confirming that this is initialized to zero, but for my own understanding I was hoping someone could explain why this is ambiguous--does it conflict with another constructor in a way that I have missed?