valarray<double>::operator%() not working

Lance Olav Eastgate lance@ccmr.cornell.edu
Fri Feb 22 10:48:00 GMT 2002


When I try to use the binary operator% or operator%= with valarray<double>
this doesn't work (in gcc 3.0.2). The reason, as far as I understand, is
that operator% is only defined for integers. The element-by-element
modulus in _DEFINE_ARRAY_FUNCTION (in valarray_array.h, line 419, gcc
3.0.2) thus doesn't work when _Tp is a double. Thus for two doubles or
floats, std::fmod (or similar) needs to be used.

Perhaps the operator% etc could be overloaded to take two doubles?

Lance



More information about the Libstdc++ mailing list