From 1c334064e853b34328c31d9f0d7e5a33b572dc5a Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sun, 7 Jun 2009 00:57:29 +0000 Subject: [PATCH] operator= support in bootstrap code --- boxedcpp/bootstrap.hpp | 17 +++++++++++++++++ boxedcpp/bootstrap_stl.hpp | 4 +--- wesley/main.cpp | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/boxedcpp/bootstrap.hpp b/boxedcpp/bootstrap.hpp index 00357e2..a691361 100644 --- a/boxedcpp/bootstrap.hpp +++ b/boxedcpp/bootstrap.hpp @@ -41,6 +41,12 @@ bool bool_or(P1 p1, P2 p2) return p1 || p2; } +template +P1 &assign(P1 &p1, const P2 &p2) +{ + return (p1 = p2); +} + template bool equals(P1 p1, P2 p2) { @@ -138,6 +144,12 @@ void add_oper_not_equals(BoxedCPP_System &s) register_function(s, ¬_equals, "!="); } +template +void add_oper_assign(BoxedCPP_System &s) +{ + register_function(s, &assign, "="); +} + template void add_oper_less_than(BoxedCPP_System &s) { @@ -220,6 +232,11 @@ void bootstrap(BoxedCPP_System &s) add_opers_comparison(s); add_opers_comparison(s); + add_oper_assign(s); + add_oper_assign(s); + add_oper_assign(s); + add_oper_assign(s); + add_opers_comparison_overload(s); add_opers_comparison_overload(s); diff --git a/boxedcpp/bootstrap_stl.hpp b/boxedcpp/bootstrap_stl.hpp index aab67df..30cb143 100644 --- a/boxedcpp/bootstrap_stl.hpp +++ b/boxedcpp/bootstrap_stl.hpp @@ -24,10 +24,8 @@ void bootstrap_random_access_container(BoxedCPP_System &system, const std::strin template void bootstrap_assignable(BoxedCPP_System &system, const std::string &type) { - /* system.register_function( - boost::function(&Assignable::operator=), "="); - */ + boost::function(&Assignable::operator=), "="); } template diff --git a/wesley/main.cpp b/wesley/main.cpp index d39c17d..7ac21da 100644 --- a/wesley/main.cpp +++ b/wesley/main.cpp @@ -441,6 +441,8 @@ BoxedCPP_System build_eval_system() { register_function(ss, &print, "print"); register_function(ss, &concat_string, "concat_string"); register_function(ss, &print, "print"); + + ss.register_function(boost::function(boost::bind(&dump_system, boost::ref(ss))), "dump_system"); ss.register_function(boost::shared_ptr( new Dynamic_Proxy_Function(boost::bind(&add_two, boost::ref(ss), _1), 2)), "add_two");