Add registration for /=, -= and += operators

This commit is contained in:
Jason Turner 2009-06-06 16:14:59 +00:00
parent a27af663fe
commit ed114102bc

View File

@ -78,11 +78,29 @@ bool greater_than_equals(P1 p1, P2 p2)
}
template<typename P1, typename P2>
P1 &timesequal(P1 &p1, P2 p2)
P1 &timesequal(P1 &p1, const P2 &p2)
{
return (p1 *= p2);
}
template<typename P1, typename P2>
P1 &dividesequal(P1 &p1, const P2 &p2)
{
return (p1 /= p2);
}
template<typename P1, typename P2>
P1 &addsequal(P1 &p1, const P2 &p2)
{
return (p1 += p2);
}
template<typename P1, typename P2>
P1 &subtractsequal(P1 &p1, const P2 &p2)
{
return (p1 -= p2);
}
//Add canonical forms of operators
template<typename T>
void add_oper_equals(BoxedCPP_System &s)
@ -170,6 +188,9 @@ void add_opers_arithmetic_overload(BoxedCPP_System &s)
register_function(s, &divide<Ret, T, R>, "/");
register_function(s, &multiply<Ret, T, R>, "*");
register_function(s, &timesequal<T, R>, "*=");
register_function(s, &dividesequal<T, R>, "/=");
register_function(s, &subtractsequal<T, R>, "-=");
register_function(s, &addsequal<T, R>, "+=");
}
template<typename T>