From 6d4ec204b0129c2a461608bf8de353eca0f10d75 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Thu, 28 May 2009 22:08:11 +0000 Subject: [PATCH] Add some more operator action --- boxedcpp/boxedcpp.hpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/boxedcpp/boxedcpp.hpp b/boxedcpp/boxedcpp.hpp index 982455d9..d5bbc807 100644 --- a/boxedcpp/boxedcpp.hpp +++ b/boxedcpp/boxedcpp.hpp @@ -135,12 +135,31 @@ Ret add(P1 p1, P2 p2) return p1 + p2; } +template +Ret subtract(P1 p1, P2 p2) +{ + return p1 - p2; +} + +template +Ret divide(P1 p1, P2 p2) +{ + return p1 - p2; +} + + template Ret multiply(P1 p1, P2 p2) { return p1 * p2; } +template +P1 ×equal(P1 &p1, P2 p2) +{ + return (p1 *= p2); +} + template std::string to_string(Input i) { @@ -156,11 +175,22 @@ void bootstrap(BoxedCPP_System &s) s.register_type("string"); s.register_function(boost::function(&add), "+"); + s.register_function(boost::function(&add), "+"); s.register_function(boost::function(&add), "+"); s.register_function(boost::function(&add), "+"); s.register_function(boost::function(&add), "+"); + s.register_function(boost::function(&subtract), "-"); + s.register_function(boost::function(&subtract), "-"); + s.register_function(boost::function(&subtract), "-"); + s.register_function(boost::function(&subtract), "-"); + + s.register_function(boost::function), "/"); + s.register_function(boost::function), "/"); + s.register_function(boost::function), "/"); + s.register_function(boost::function), "/"); + s.register_function(boost::function(&multiply), "*"); s.register_function(boost::function(&multiply), "*"); s.register_function(boost::function(&multiply), "*"); @@ -171,6 +201,15 @@ void bootstrap(BoxedCPP_System &s) s.register_function(boost::function(&to_string), "to_string"); s.register_function(boost::function(&to_string), "to_string"); + s.register_function(boost::function(×equal), "*="); + s.register_function(boost::function(×equal), "*="); + s.register_function(boost::function(×equal), "*="); + s.register_function(boost::function(×equal), "*="); + + + + + }