Global const values for booleans

- Reduces number of Boxed_Value constructions greatly
This commit is contained in:
Jason Turner
2015-05-02 13:08:23 -06:00
parent e64e4b0877
commit 45baf6f8e9

View File

@@ -409,6 +409,16 @@ namespace chaiscript
return detail::const_var_impl(t);
}
inline Boxed_Value const_var(bool b) {
static auto t = detail::const_var_impl(true);
static auto f = detail::const_var_impl(false);
if (b) {
return t;
} else {
return f;
}
}
}