mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
Global const values for booleans
- Reduces number of Boxed_Value constructions greatly
This commit is contained in:
parent
e64e4b0877
commit
45baf6f8e9
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user