Pass Module by reference instead of shared ptr
This gives a small but noticeable compile time improvement as well as a measurable, albeit not great, reduction in size of the stdlib.
This commit is contained in:
@@ -9,11 +9,11 @@ namespace chaiscript
|
||||
{
|
||||
public:
|
||||
|
||||
static ModulePtr library(ModulePtr m = std::make_shared<Module>())
|
||||
static Module& library(Module& m)
|
||||
{
|
||||
|
||||
m->add(chaiscript::fun([](const std::string &t_str) { return from_json(t_str); }), "from_json");
|
||||
m->add(chaiscript::fun(&json_wrap::to_json), "to_json");
|
||||
m.add(chaiscript::fun([](const std::string &t_str) { return from_json(t_str); }), "from_json");
|
||||
m.add(chaiscript::fun(&json_wrap::to_json), "to_json");
|
||||
|
||||
return m;
|
||||
|
||||
|
Reference in New Issue
Block a user