diff --git a/boxedcpp/bootstrap_stl.hpp b/boxedcpp/bootstrap_stl.hpp index 30cb1430..7e0a3f5d 100644 --- a/boxedcpp/bootstrap_stl.hpp +++ b/boxedcpp/bootstrap_stl.hpp @@ -16,9 +16,9 @@ void bootstrap_random_access_container(BoxedCPP_System &system, const std::strin typedef typename ContainerType::reference(ContainerType::*indexoper)(size_t); system.register_function( - boost::function(indexoper(&ContainerType::operator[])), "[]"); + boost::function(indexoper(&ContainerType::at)), "[]"); system.register_function( - boost::function(indexoper(&ContainerType::at)), "at"); + boost::function(indexoper(&ContainerType::operator[])), "at"); } template diff --git a/wesley/wesley_eval.hpp b/wesley/wesley_eval.hpp index 6b1b8ef9..0667851d 100644 --- a/wesley/wesley_eval.hpp +++ b/wesley/wesley_eval.hpp @@ -131,6 +131,9 @@ Boxed_Value eval_token(Eval_System &ss, TokenPtr node) { try { retval = dispatch(ss.get_function("[]"), plb); } + catch(std::out_of_range &oor) { + throw EvalError("Out of bounds exception", node); + } catch(std::exception &e){ throw EvalError("Can not find appropriate array lookup '[]'", node->children[i]); }