diff --git a/include/chaiscript/dispatchkit/bootstrap.hpp b/include/chaiscript/dispatchkit/bootstrap.hpp index 55e0271..7889ec1 100644 --- a/include/chaiscript/dispatchkit/bootstrap.hpp +++ b/include/chaiscript/dispatchkit/bootstrap.hpp @@ -443,7 +443,7 @@ namespace chaiscript operators::assign(m); operators::equal(m); - m->add(fun(&to_string), "to_string"); + m->add(fun([](const std::string &s) -> std::string { return s; }), "to_string"); m->add(fun(&Bootstrap::bool_to_string), "to_string"); m->add(fun(&unknown_assign), "="); m->add(fun(&throw_exception), "throw"); diff --git a/include/chaiscript/dispatchkit/dispatchkit.hpp b/include/chaiscript/dispatchkit/dispatchkit.hpp index 6428677..fbf6d53 100644 --- a/include/chaiscript/dispatchkit/dispatchkit.hpp +++ b/include/chaiscript/dispatchkit/dispatchkit.hpp @@ -443,17 +443,13 @@ namespace chaiscript /// Adds a named object to the current scope + /// \warning This version does not check the validity of the name + /// it is meant for internal use only void add_object(const std::string &name, const Boxed_Value &obj) const { - auto &stack = get_stack_data(); - validate_object_name(name); - - auto &scope = stack.back(); - if (scope.find(name) != scope.end()) + if (!get_stack_data().back().insert(std::make_pair(name, obj)).second) { throw chaiscript::exception::name_conflict_error(name); - } else { - scope.insert(std::make_pair(name, obj)); } }