Overloading the modulus operator.

Say I wanted to overload the modulus operator to return the remainder of a division between two floating point numbers. Why isn't a custom double operator%(double, double) allowed even though that function isn't available in the standard anyway?

Edited my wording after realizing how stupid it sounded.
Last edited on
you cannot overload operators for built-in types. At least one parameter should be a class type.
"Operator overloads must have at least one of their arguments as a user-defined type. So you cannot do this."

http://stackoverflow.com/questions/7192855/how-to-overload-operator-in-c
I guess I'm kind of asking why the ANSI standard doesn't allow for this specific overload even though a standard one is not available.
FML, I never knew about that function.
Topic archived. No new replies allowed.