Compare commits

..

No commits in common. "expr-explicit-conversions" and "master" have entirely different histories.

5 changed files with 2 additions and 39 deletions

View file

@ -217,10 +217,6 @@ 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()) //
;
}
} const unary_func_types;

View file

@ -89,30 +89,6 @@ struct length_impl
value_type operator()(value_type const& val) const { return val.to_unicode().length(); }
};
// str
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
{
value_type operator()(value_type const& val) const { return val.to_int(); }
};
// float
struct float_impl
{
value_type operator()(value_type const& val) const { return val.to_double(); }
};
// min
inline value_type min_impl(value_type const& arg1, value_type const& arg2)
{

View file

@ -27,7 +27,7 @@
#define MAPNIK_MAJOR_VERSION 4
#define MAPNIK_MINOR_VERSION 0
#define MAPNIK_PATCH_VERSION 4
#define MAPNIK_PATCH_VERSION 3
#define MAPNIK_VERSION MAPNIK_VERSION_ENCODE(MAPNIK_MAJOR_VERSION, MAPNIK_MINOR_VERSION, MAPNIK_PATCH_VERSION)

View file

@ -441,7 +441,7 @@ struct convert<value_bool>
template<typename T>
value_bool operator()(T val) const
{
return val == 0 ? false : true;
return val > 0 ? true : false;
}
};

View file

@ -94,15 +94,6 @@ TEST_CASE("expressions")
TRY_CHECK(parse_and_dump("'escaped \\' apostrophe'") == "'escaped \\' apostrophe'");
TRY_CHECK(parse_and_dump("'escaped \\\\ backslash'") == "'escaped \\\\ backslash'");
// explicit conversions
TRY_CHECK(eval("int('123')") == 123);
TRY_CHECK(eval("float('3.14'+'159')") == 3.14159);
TRY_CHECK(eval("bool(-0.001)") == true);
TRY_CHECK(eval("bool(0.001)") == true);
TRY_CHECK(eval("bool(0.0)") == false);
TRY_CHECK(eval("str(123)") == tr.transcode("123"));
TRY_CHECK(eval("float(str(3.14) + str(159))") == 3.14159);
// floating point constants
TRY_CHECK(parse_and_dump("pi") == "3.14159");
TRY_CHECK(parse_and_dump("deg_to_rad") == "0.0174533");