Overloading the modulus operator.

May 27, 2013 at 5:07am
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 May 27, 2013 at 5:20am
May 27, 2013 at 5:20am
you cannot overload operators for built-in types. At least one parameter should be a class type.
May 27, 2013 at 5:20am
"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
May 27, 2013 at 5:31am
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.
May 27, 2013 at 5:32am
May 27, 2013 at 5:34am
FML, I never knew about that function.
Topic archived. No new replies allowed.