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:
Bjorn Fahller
2016-04-09 15:42:55 +02:00
parent 5567e767a3
commit 5ff97979fd
9 changed files with 301 additions and 344 deletions

View File

@@ -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;