expressions - add "bool(expr)" explicit conversion operator

This commit is contained in:
Artem Pavlenko 2024-11-13 14:03:01 +00:00
parent 2e175a16fe
commit dfdeda17fd
2 changed files with 7 additions and 0 deletions

View file

@ -217,6 +217,7 @@ struct unary_function_types_ : x3::symbols<unary_function_impl>
("log", log_impl()) //
("abs", abs_impl()) //
("length", length_impl()) //
("bool", bool_impl()) //
("int", int_impl()) //
("float", float_impl()) //
("str", str_impl()) //

View file

@ -95,6 +95,12 @@ struct str_impl
value_type operator()(value_type const& val) const { return val.to_unicode(); }
};
// bool
struct bool_impl
{
value_type operator()(value_type const& val) const { return val.to_bool(); }
};
// int
struct int_impl
{