diff --git a/include/chaiscript/dispatchkit/bootstrap_stl.hpp b/include/chaiscript/dispatchkit/bootstrap_stl.hpp index 06f3ce7..bbf0cce 100644 --- a/include/chaiscript/dispatchkit/bootstrap_stl.hpp +++ b/include/chaiscript/dispatchkit/bootstrap_stl.hpp @@ -158,7 +158,7 @@ namespace chaiscript template ModulePtr container_type(const std::string &/*type*/, ModulePtr m = ModulePtr(new Module())) { - m->add(fun(&ContainerType::size), "size"); + m->add(fun(boost::function(&ContainerType::size)), "size"); m->add(fun(&ContainerType::empty), "empty"); m->add(fun(&ContainerType::clear), "clear"); @@ -319,7 +319,8 @@ namespace chaiscript template ModulePtr unique_associative_container_type(const std::string &/*type*/, ModulePtr m = ModulePtr(new Module())) { - m->add(fun(&ContainerType::count), "count"); +// m->add(fun(&ContainerType::count), "count"); + m->add(fun(boost::function(&ContainerType::count)), "count"); return m; } @@ -412,13 +413,16 @@ namespace chaiscript } m->add(fun(&String::push_back), push_back_name); - typedef typename String::size_type (String::*find_func)(const String &, typename String::size_type) const; - m->add(fun(static_cast(&String::find)), "find"); - m->add(fun(static_cast(&String::rfind)), "rfind"); - m->add(fun(static_cast(&String::find_first_of)), "find_first_of"); - m->add(fun(static_cast(&String::find_last_of)), "find_last_of"); - m->add(fun(static_cast(&String::find_first_not_of)), "find_first_not_of"); - m->add(fun(static_cast(&String::find_last_not_of)), "find_last_not_of"); + typedef typename String::size_type (String::*find_func_ptr)(const String &, typename String::size_type) const; + + typedef boost::function find_func; + + m->add(fun(find_func(static_cast(&String::find))), "find"); + m->add(fun(find_func(static_cast(&String::rfind))), "rfind"); + m->add(fun(find_func(static_cast(&String::find_first_of))), "find_first_of"); + m->add(fun(find_func(static_cast(&String::find_last_of))), "find_last_of"); + m->add(fun(find_func(static_cast(&String::find_first_not_of))), "find_first_not_of"); + m->add(fun(find_func(static_cast(&String::find_last_not_of))), "find_last_not_of"); return m; } diff --git a/include/chaiscript/language/chaiscript_prelude.hpp b/include/chaiscript/language/chaiscript_prelude.hpp index 3476d6e..e73084e 100644 --- a/include/chaiscript/language/chaiscript_prelude.hpp +++ b/include/chaiscript/language/chaiscript_prelude.hpp @@ -282,27 +282,27 @@ def zip(x, y) { \n\ }\n\ # Returns the position of the second value string in the first value string\n\ def string::find(substr) : is_type(substr, "string") { \n\ - int(find(this, substr, size_t(0))); \n\ + int(find(this, substr, 0)); \n\ } \n\ # Returns the position of last match of the second value string in the first value string\n\ def string::rfind(substr) : is_type(substr, "string") { \n\ - int(rfind(this, substr, size_t(-1))); \n\ + int(rfind(this, substr, -1)); \n\ } \n\ # Returns the position of the first match of elements in the second value string in the first value string\n\ def string::find_first_of(list) : is_type(list, "string") { \n\ - int(find_first_of(this, list, size_t(0))); \n\ + int(find_first_of(this, list, 0)); \n\ } \n\ # Returns the position of the last match of elements in the second value string in the first value string\n\ def string::find_last_of(list) : is_type(list, "string") { \n\ - int(find_last_of(this, list, size_t(-1))); \n\ + int(find_last_of(this, list, -1)); \n\ } \n\ # Returns the position of the first non-matching element in the second value string in the first value string\n\ def string::find_first_not_of(list) : is_type(list, "string") { \n\ - int(find_first_not_of(this, list, size_t(0))); \n\ + int(find_first_not_of(this, list, 0)); \n\ } \n\ # Returns the position of the last non-matching element in the second value string in the first value string\n\ def string::find_last_not_of(list) : is_type(list, "string") { \n\ - int(find_last_not_of(this, list, size_t(-1))); \n\ + int(find_last_not_of(this, list, -1)); \n\ } \n\ def string::ltrim() { \n\ drop_while(this, fun(x) { x == ' ' || x == '\t' }); \n\