Reduce cost of including chaiscript.hpp

- ChaiScript no longer includes or automatically instantiates std lib
 - ChaiScript constructor now requires an std lib instance in the form
   of a ModulePtr object
 - This new layout facilitates better usage of compilation firewalls and
   factories for reducing the overall impact of ChaiScript on a project
This commit is contained in:
Jason Turner
2011-12-27 21:37:00 -07:00
parent 9a9d4e1ae0
commit 136b877afa
20 changed files with 72 additions and 56 deletions

View File

@@ -478,7 +478,7 @@ namespace chaiscript
m->add(Proxy_Function(new dispatch::Dynamic_Proxy_Function(std::bind(&call_exists, std::placeholders::_1))),
"call_exists");
m->add(fun(&type_match), "type_match");
m->add(fun(&Boxed_Value::type_match), "type_match");
return m;
}

View File

@@ -17,6 +17,7 @@
#define CHAISCRIPT_BOOTSTRAP_STL_HPP_
#include "dispatchkit.hpp"
#include "bootstrap.hpp"
#include "register_function.hpp"
namespace chaiscript

View File

@@ -263,6 +263,12 @@ namespace chaiscript
return m_data->m_const_data_ptr;
}
/// \returns true if the two Boxed_Values share the same internal type
static bool type_match(Boxed_Value l, Boxed_Value r)
{
return l.get_type_info() == r.get_type_info();
}
private:
std::shared_ptr<Data> m_data;
};
@@ -361,11 +367,6 @@ namespace chaiscript
/// \returns true if the two Boxed_Values share the same internal type
static bool type_match(Boxed_Value l, Boxed_Value r)
{
return l.get_type_info() == r.get_type_info();
}
}
#endif