diff --git a/chaiscript/chaiscript_engine.hpp b/chaiscript/chaiscript_engine.hpp index 89a9034..08c7e01 100644 --- a/chaiscript/chaiscript_engine.hpp +++ b/chaiscript/chaiscript_engine.hpp @@ -199,7 +199,7 @@ namespace chaiscript dispatchkit::Bootstrap::bootstrap(ss); dispatchkit::bootstrap_vector >(ss, "Vector"); dispatchkit::bootstrap_map >(ss, "Map"); - + dispatchkit::bootstrap_pair >(ss, "Pair"); ss.register_function(boost::shared_ptr( new dispatchkit::Dynamic_Proxy_Function(boost::bind(&ChaiScript_System::eval, boost::ref(*this), _1), 1)), "eval"); diff --git a/dispatchkit/bootstrap_stl.hpp b/dispatchkit/bootstrap_stl.hpp index 4b0a34c..25d088c 100644 --- a/dispatchkit/bootstrap_stl.hpp +++ b/dispatchkit/bootstrap_stl.hpp @@ -164,6 +164,16 @@ namespace dispatchkit { bootstrap_associative_container(system, type); register_function(system, &ContainerType::count, "count"); + } + + template + void bootstrap_pair(Dispatch_Engine &system, const std::string &type) + { + register_member(system, &PairType::first, "first"); + register_member(system, &PairType::second, "second"); + + system.register_function(build_constructor(), type); + system.register_function(build_constructor(), type); } template diff --git a/samples/callbacks.chai b/samples/callbacks.chai index ec8acac..98c5263 100644 --- a/samples/callbacks.chai +++ b/samples/callbacks.chai @@ -1,5 +1,5 @@ cb_handler.add_callbacks( function() { "First"; }, function (x) { x * 1.1; } ); -cb_handler.add_callbacks( function() { "TimesThree"; }, function (x) { x * 3.0001; } ); +cb_handler.add_callbacks( function() { "TimesThree"; }, function(x) { x * 3.0} ); cb_handler.add_callbacks( function() { "DivOnePtTwo"; }, function (x) { x / 1.2; } );