C++ Mathematical Expression Library (ExprTk) https://www.partow.net/programming/exprtk/index.html
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8e95be7..a0cba13 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -6,6 +6,7 @@
- image: gcc:6
steps:
- checkout
+ - run: c++ --version
- run: make all -j 2
- run: ./exprtk_test
@@ -14,6 +15,7 @@
- image: gcc:7
steps:
- checkout
+ - run: c++ --version
- run: make all -j 2
- run: ./exprtk_test
@@ -22,6 +24,7 @@
- image: gcc:latest
steps:
- checkout
+ - run: c++ --version
- run: make all -j 2
- run: ./exprtk_test
diff --git a/Makefile b/Makefile
index 76d43a0..bdae9b1 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
# **************************************************************
# * C++ Mathematical Expression Toolkit Library *
# * *
-# * Author: Arash Partow (1999-2020) *
+# * Author: Arash Partow (1999-2021) *
# * URL: http://www.partow.net/programming/exprtk/index.html *
# * *
# * Copyright notice: *
diff --git a/exprtk.hpp b/exprtk.hpp
index 0b2081e..16a4839 100644
--- a/exprtk.hpp
+++ b/exprtk.hpp
@@ -2,14 +2,14 @@
******************************************************************
* C++ Mathematical Expression Toolkit Library *
* *
- * Author: Arash Partow (1999-2020) *
- * URL: http://www.partow.net/programming/exprtk/index.html *
+ * Author: Arash Partow (1999-2021) *
+ * URL: https://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
* Free use of the C++ Mathematical Expression Toolkit Library is *
* permitted under the guidelines and in accordance with the most *
* current version of the MIT License. *
- * http://www.opensource.org/licenses/MIT *
+ * https://www.opensource.org/licenses/MIT *
* *
* Example expressions: *
* (00) (y + x / y) * (x - y / x) *
@@ -82,16 +82,26 @@
#define exprtk_disable_fallthrough_end (void)0;
#endif
+ #if __cplusplus >= 201103L
+ #define exprtk_override override
+ #define exprtk_final final
+ #define exprtk_delete = delete
+ #else
+ #define exprtk_override
+ #define exprtk_final
+ #define exprtk_delete
+ #endif
+
namespace details
{
- typedef unsigned char uchar_t;
- typedef char char_t;
- typedef uchar_t* uchar_ptr;
- typedef char_t* char_ptr;
- typedef uchar_t const* uchar_cptr;
+ typedef char char_t;
+ typedef char_t* char_ptr;
typedef char_t const* char_cptr;
+ typedef unsigned char uchar_t;
+ typedef uchar_t* uchar_ptr;
+ typedef uchar_t const* uchar_cptr;
typedef unsigned long long int _uint64_t;
- typedef long long int _int64_t;
+ typedef long long int _int64_t;
inline bool is_whitespace(const char_t c)
{
@@ -167,7 +177,7 @@
inline bool is_valid_string_char(const char_t c)
{
- return std::isprint(static_cast<unsigned char>(c)) ||
+ return std::isprint(static_cast<uchar_t>(c)) ||
is_whitespace(c);
}
@@ -211,8 +221,8 @@
for (std::size_t i = 0; i < length; ++i)
{
- const char_t c1 = static_cast<char>(std::tolower(s1[i]));
- const char_t c2 = static_cast<char>(std::tolower(s2[i]));
+ const char_t c1 = static_cast<char_t>(std::tolower(s1[i]));
+ const char_t c2 = static_cast<char_t>(std::tolower(s2[i]));
if (c1 > c2)
return false;
@@ -274,25 +284,21 @@
std::string result;
- if (i < 0)
- {
- for ( ; i; i /= 10)
- {
- result += '0' + char(-(i % 10));
- }
+ const int sign = (i < 0) ? -1 : 1;
- result += '-';
- }
- else
+ for ( ; i; i /= 10)
{
- for ( ; i; i /= 10)
- {
- result += '0' + char(i % 10);
- }
+ result += '0' + static_cast<char_t>(sign * (i % 10));
+ }
+
+ if (sign < 0)
+ {
+ result += '-';
}
std::reverse(result.begin(), result.end());
+
return result;
}
@@ -301,7 +307,7 @@
return to_str(static_cast<int>(i));
}
- inline bool is_hex_digit(const std::string::value_type digit)
+ inline bool is_hex_digit(const uchar_t digit)
{
return (('0' <= digit) && (digit <= '9')) ||
(('A' <= digit) && (digit <= 'F')) ||
@@ -313,12 +319,12 @@
if (('0' <= h) && (h <= '9'))
return (h - '0');
else
- return static_cast<unsigned char>(std::toupper(h) - 'A');
+ return static_cast<uchar_t>(std::toupper(h) - 'A');
}
template <typename Iterator>
inline bool parse_hex(Iterator& itr, Iterator end,
- std::string::value_type& result)
+ char_t& result)
{
if (
(end == (itr )) ||
@@ -597,68 +603,63 @@
const Iterator data_begin ,
const Iterator data_end ,
const typename std::iterator_traits<Iterator>::value_type& zero_or_more,
- const typename std::iterator_traits<Iterator>::value_type& zero_or_one )
+ const typename std::iterator_traits<Iterator>::value_type& exactly_one )
{
const Iterator null_itr(0);
- Iterator d_itr = data_begin;
- Iterator p_itr = pattern_begin;
- Iterator tb_p_itr = null_itr;
- Iterator tb_d_itr = null_itr;
+ Iterator p_itr = pattern_begin;
+ Iterator d_itr = data_begin;
+ Iterator np_itr = null_itr;
+ Iterator nd_itr = null_itr;
- while (d_itr != data_end)
+ for ( ; ; )
{
- if (zero_or_more == *p_itr)
+ const bool pvalid = p_itr != pattern_end;
+ const bool dvalid = d_itr != data_end;
+
+ if (!pvalid && !dvalid)
+ break;
+
+ if (pvalid)
{
- while ((pattern_end != p_itr) && ((zero_or_more == *p_itr) || (zero_or_one == *p_itr)))
- {
- ++p_itr;
- }
-
- if (pattern_end == p_itr)
- return true;
-
const typename std::iterator_traits<Iterator>::value_type c = *(p_itr);
- while ((data_end != d_itr) && !Compare::cmp(c,*d_itr))
+ if (zero_or_more == c)
{
- ++d_itr;
+ np_itr = p_itr;
+ nd_itr = d_itr + 1;
+ ++p_itr;
+ continue;
}
-
- tb_p_itr = p_itr;
- tb_d_itr = d_itr;
-
- continue;
+ else if (dvalid && ((exactly_one == c) || Compare::cmp(c,*(d_itr))))
+ {
+ ++p_itr;
+ ++d_itr;
+ continue;
+ }
}
- else if (!Compare::cmp(*p_itr, *d_itr) && (zero_or_one != *p_itr))
+
+ if ((null_itr != nd_itr) && (nd_itr <= data_end))
{
- if (null_itr == tb_d_itr)
- return false;
-
- d_itr = tb_d_itr++;
- p_itr = tb_p_itr;
-
+ p_itr = np_itr;
+ d_itr = nd_itr;
continue;
}
- ++p_itr;
- ++d_itr;
+ return false;
}
- while ((pattern_end != p_itr) && ((zero_or_more == *p_itr) || (zero_or_one == *p_itr)))
- {
- ++p_itr;
- }
-
- return (pattern_end == p_itr);
+ return true;
}
inline bool wc_match(const std::string& wild_card,
const std::string& str)
{
return match_impl<char_cptr,cs_match>(
- wild_card.data(), wild_card.data() + wild_card.size(),
- str.data(), str.data() + str.size(),
+ wild_card.data(),
+ wild_card.data() + wild_card.size(),
+ str.data(),
+ str.data() + str.size(),
'*', '?');
}
@@ -666,8 +667,10 @@
const std::string& str)
{
return match_impl<char_cptr,cis_match>(
- wild_card.data(), wild_card.data() + wild_card.size(),
- str.data(), str.data() + str.size(),
+ wild_card.data(),
+ wild_card.data() + wild_card.size(),
+ str.data(),
+ str.data() + str.size(),
'*', '?');
}
@@ -688,19 +691,19 @@
itr_t p_itr = pattern.begin();
itr_t s_itr = str .begin();
- itr_t p_end = pattern.end();
- itr_t s_end = str .end();
+ const itr_t p_end = pattern.end();
+ const itr_t s_end = str .end();
while ((s_end != s_itr) && (p_end != p_itr))
{
if ('*' == (*p_itr))
{
- const char_t target = static_cast<char>(std::toupper(*(p_itr - 1)));
+ const char_t target = static_cast<char_t>(std::toupper(*(p_itr - 1)));
if ('*' == target)
{
diff_index = static_cast<std::size_t>(std::distance(str.begin(),s_itr));
- diff_value = static_cast<char>(std::toupper(*p_itr));
+ diff_value = static_cast<char_t>(std::toupper(*p_itr));
return false;
}
@@ -723,7 +726,7 @@
)
{
diff_index = static_cast<std::size_t>(std::distance(str.begin(),s_itr));
- diff_value = static_cast<char>(std::toupper(*p_itr));
+ diff_value = static_cast<char_t>(std::toupper(*p_itr));
return false;
}
@@ -782,15 +785,15 @@
};
#define exprtk_register_real_type_tag(T) \
- template<> struct number_type<T> \
+ template <> struct number_type<T> \
{ typedef real_type_tag type; number_type() {} }; \
#define exprtk_register_complex_type_tag(T) \
- template<> struct number_type<std::complex<T> > \
+ template <> struct number_type<std::complex<T> > \
{ typedef complex_type_tag type; number_type() {} }; \
#define exprtk_register_int_type_tag(T) \
- template<> struct number_type<T> \
+ template <> struct number_type<T> \
{ typedef int_type_tag type; number_type() {} }; \
exprtk_register_real_type_tag(double )
@@ -812,34 +815,23 @@
#undef exprtk_register_int_type_tag
template <typename T>
- struct epsilon_type
- {
- static inline T value()
- {
- const T epsilon = T(0.0000000001);
- return epsilon;
- }
- };
+ struct epsilon_type {};
- template <>
- struct epsilon_type <float>
- {
- static inline float value()
- {
- const float epsilon = float(0.000001f);
- return epsilon;
- }
- };
+ #define exprtk_define_epsilon_type(Type, Epsilon) \
+ template <> struct epsilon_type<Type> \
+ { \
+ static inline Type value() \
+ { \
+ const Type epsilon = static_cast<Type>(Epsilon); \
+ return epsilon; \
+ } \
+ }; \
- template <>
- struct epsilon_type <long double>
- {
- static inline long double value()
- {
- const long double epsilon = (long double)(0.000000000001);
- return epsilon;
- }
- };
+ exprtk_define_epsilon_type(float , 0.00000100000f)
+ exprtk_define_epsilon_type(double , 0.000000000100)
+ exprtk_define_epsilon_type(long double, 0.000000000001)
+
+ #undef exprtk_define_epsilon_type
template <typename T>
inline bool is_nan_impl(const T v, real_type_tag)
@@ -1037,7 +1029,7 @@
template <typename T>
inline T roundn_impl(const T v0, const T v1, real_type_tag)
{
- const int index = std::max<int>(0, std::min<int>(pow10_size - 1, (int)std::floor(v1)));
+ const int index = std::max<int>(0, std::min<int>(pow10_size - 1, static_cast<int>(std::floor(v1))));
const T p10 = T(pow10[index]);
if (v0 < T(0))
@@ -1103,7 +1095,7 @@
template <typename T>
inline T sgn_impl(const T v, real_type_tag)
{
- if (v > T(0)) return T(+1);
+ if (v > T(0)) return T(+1);
else if (v < T(0)) return T(-1);
else return T( 0);
}
@@ -1111,7 +1103,7 @@
template <typename T>
inline T sgn_impl(const T v, int_type_tag)
{
- if (v > T(0)) return T(+1);
+ if (v > T(0)) return T(+1);
else if (v < T(0)) return T(-1);
else return T( 0);
}
@@ -1201,8 +1193,8 @@
}
#if (defined(_MSC_VER) && (_MSC_VER >= 1900)) || !defined(_MSC_VER)
- #define exprtk_define_erf(TT,impl) \
- inline TT erf_impl(TT v) { return impl(v); } \
+ #define exprtk_define_erf(TT, impl) \
+ inline TT erf_impl(const TT v) { return impl(v); } \
exprtk_define_erf( float,::erff)
exprtk_define_erf( double,::erf )
@@ -1211,7 +1203,7 @@
#endif
template <typename T>
- inline T erf_impl(T v, real_type_tag)
+ inline T erf_impl(const T v, real_type_tag)
{
#if defined(_MSC_VER) && (_MSC_VER < 1900)
// Credits: Abramowitz & Stegun Equations 7.1.25-28
@@ -1225,12 +1217,12 @@
const T t = T(1) / (T(1) + T(0.5) * abs_impl(v,real_type_tag()));
- T result = T(1) - t * std::exp((-v * v) -
- c[0] + t * (c[1] + t *
- (c[2] + t * (c[3] + t *
- (c[4] + t * (c[5] + t *
- (c[6] + t * (c[7] + t *
- (c[8] + t * (c[9]))))))))));
+ const T result = T(1) - t * std::exp((-v * v) -
+ c[0] + t * (c[1] + t *
+ (c[2] + t * (c[3] + t *
+ (c[4] + t * (c[5] + t *
+ (c[6] + t * (c[7] + t *
+ (c[8] + t * (c[9]))))))))));
return (v >= T(0)) ? result : -result;
#else
@@ -1239,23 +1231,23 @@
}
template <typename T>
- inline T erf_impl(T v, int_type_tag)
+ inline T erf_impl(const T v, int_type_tag)
{
return erf_impl(static_cast<double>(v),real_type_tag());
}
#if (defined(_MSC_VER) && (_MSC_VER >= 1900)) || !defined(_MSC_VER)
- #define exprtk_define_erfc(TT,impl) \
- inline TT erfc_impl(TT v) { return impl(v); } \
+ #define exprtk_define_erfc(TT, impl) \
+ inline TT erfc_impl(const TT v) { return impl(v); } \
- exprtk_define_erfc( float,::erfcf)
- exprtk_define_erfc( double,::erfc )
+ exprtk_define_erfc(float ,::erfcf)
+ exprtk_define_erfc(double ,::erfc )
exprtk_define_erfc(long double,::erfcl)
#undef exprtk_define_erfc
#endif
template <typename T>
- inline T erfc_impl(T v, real_type_tag)
+ inline T erfc_impl(const T v, real_type_tag)
{
#if defined(_MSC_VER) && (_MSC_VER < 1900)
return T(1) - erf_impl(v,real_type_tag());
@@ -1265,28 +1257,28 @@
}
template <typename T>
- inline T erfc_impl(T v, int_type_tag)
+ inline T erfc_impl(const T v, int_type_tag)
{
return erfc_impl(static_cast<double>(v),real_type_tag());
}
template <typename T>
- inline T ncdf_impl(T v, real_type_tag)
+ inline T ncdf_impl(const T v, real_type_tag)
{
- T cnd = T(0.5) * (T(1) + erf_impl(
- abs_impl(v,real_type_tag()) /
- T(numeric::constant::sqrt2),real_type_tag()));
+ const T cnd = T(0.5) * (T(1) +
+ erf_impl(abs_impl(v,real_type_tag()) /
+ T(numeric::constant::sqrt2),real_type_tag()));
return (v < T(0)) ? (T(1) - cnd) : cnd;
}
template <typename T>
- inline T ncdf_impl(T v, int_type_tag)
+ inline T ncdf_impl(const T v, int_type_tag)
{
return ncdf_impl(static_cast<double>(v),real_type_tag());
}
template <typename T>
- inline T sinc_impl(T v, real_type_tag)
+ inline T sinc_impl(const T v, real_type_tag)
{
if (std::abs(v) >= std::numeric_limits<T>::epsilon())
return(std::sin(v) / v);
@@ -1295,7 +1287,7 @@
}
template <typename T>
- inline T sinc_impl(T v, int_type_tag)
+ inline T sinc_impl(const T v, int_type_tag)
{
return sinc_impl(static_cast<double>(v),real_type_tag());
}
@@ -1326,14 +1318,15 @@
template <typename T> inline T csc_impl(const T v, real_type_tag) { return T(1) / std::sin(v); }
template <typename T> inline T r2d_impl(const T v, real_type_tag) { return (v * T(numeric::constant::_180_pi)); }
template <typename T> inline T d2r_impl(const T v, real_type_tag) { return (v * T(numeric::constant::pi_180)); }
- template <typename T> inline T d2g_impl(const T v, real_type_tag) { return (v * T(20.0/9.0)); }
- template <typename T> inline T g2d_impl(const T v, real_type_tag) { return (v * T(9.0/20.0)); }
+ template <typename T> inline T d2g_impl(const T v, real_type_tag) { return (v * T(10.0/9.0)); }
+ template <typename T> inline T g2d_impl(const T v, real_type_tag) { return (v * T(9.0/10.0)); }
template <typename T> inline T notl_impl(const T v, real_type_tag) { return (std::not_equal_to<T>()(T(0),v) ? T(0) : T(1)); }
template <typename T> inline T frac_impl(const T v, real_type_tag) { return (v - static_cast<long long>(v)); }
template <typename T> inline T trunc_impl(const T v, real_type_tag) { return T(static_cast<long long>(v)); }
- template <typename T> inline T const_pi_impl(real_type_tag) { return T(numeric::constant::pi); }
- template <typename T> inline T const_e_impl (real_type_tag) { return T(numeric::constant::e); }
+ template <typename T> inline T const_pi_impl(real_type_tag) { return T(numeric::constant::pi); }
+ template <typename T> inline T const_e_impl(real_type_tag) { return T(numeric::constant::e); }
+ template <typename T> inline T const_qnan_impl(real_type_tag) { return std::numeric_limits<T>::quiet_NaN(); }
template <typename T> inline T abs_impl(const T v, int_type_tag) { return ((v >= T(0)) ? v : -v); }
template <typename T> inline T exp_impl(const T v, int_type_tag) { return std::exp (v); }
@@ -1381,10 +1374,10 @@
template <typename Type>
struct numeric_info { enum { length = 0, size = 32, bound_length = 0, min_exp = 0, max_exp = 0 }; };
- template<> struct numeric_info<int> { enum { length = 10, size = 16, bound_length = 9}; };
- template<> struct numeric_info<float> { enum { min_exp = -38, max_exp = +38}; };
- template<> struct numeric_info<double> { enum { min_exp = -308, max_exp = +308}; };
- template<> struct numeric_info<long double> { enum { min_exp = -308, max_exp = +308}; };
+ template <> struct numeric_info<int > { enum { length = 10, size = 16, bound_length = 9 }; };
+ template <> struct numeric_info<float > { enum { min_exp = -38, max_exp = +38 }; };
+ template <> struct numeric_info<double > { enum { min_exp = -308, max_exp = +308 }; };
+ template <> struct numeric_info<long double> { enum { min_exp = -308, max_exp = +308 }; };
template <typename T>
inline int to_int32(const T v)
@@ -1557,31 +1550,31 @@
while (k)
{
- if (k & 1)
+ if (1 == (k % 2))
{
l *= v;
--k;
}
v *= v;
- k >>= 1;
+ k /= 2;
}
return l;
}
};
- template <typename T> struct fast_exp<T,10> { static inline T result(T v) { T v_5 = fast_exp<T,5>::result(v); return v_5 * v_5; } };
- template <typename T> struct fast_exp<T, 9> { static inline T result(T v) { return fast_exp<T,8>::result(v) * v; } };
- template <typename T> struct fast_exp<T, 8> { static inline T result(T v) { T v_4 = fast_exp<T,4>::result(v); return v_4 * v_4; } };
- template <typename T> struct fast_exp<T, 7> { static inline T result(T v) { return fast_exp<T,6>::result(v) * v; } };
- template <typename T> struct fast_exp<T, 6> { static inline T result(T v) { T v_3 = fast_exp<T,3>::result(v); return v_3 * v_3; } };
- template <typename T> struct fast_exp<T, 5> { static inline T result(T v) { return fast_exp<T,4>::result(v) * v; } };
- template <typename T> struct fast_exp<T, 4> { static inline T result(T v) { T v_2 = v * v; return v_2 * v_2; } };
- template <typename T> struct fast_exp<T, 3> { static inline T result(T v) { return v * v * v; } };
- template <typename T> struct fast_exp<T, 2> { static inline T result(T v) { return v * v; } };
- template <typename T> struct fast_exp<T, 1> { static inline T result(T v) { return v; } };
- template <typename T> struct fast_exp<T, 0> { static inline T result(T ) { return T(1); } };
+ template <typename T> struct fast_exp<T,10> { static inline T result(const T v) { T v_5 = fast_exp<T,5>::result(v); return v_5 * v_5; } };
+ template <typename T> struct fast_exp<T, 9> { static inline T result(const T v) { return fast_exp<T,8>::result(v) * v; } };
+ template <typename T> struct fast_exp<T, 8> { static inline T result(const T v) { T v_4 = fast_exp<T,4>::result(v); return v_4 * v_4; } };
+ template <typename T> struct fast_exp<T, 7> { static inline T result(const T v) { return fast_exp<T,6>::result(v) * v; } };
+ template <typename T> struct fast_exp<T, 6> { static inline T result(const T v) { T v_3 = fast_exp<T,3>::result(v); return v_3 * v_3; } };
+ template <typename T> struct fast_exp<T, 5> { static inline T result(const T v) { return fast_exp<T,4>::result(v) * v; } };
+ template <typename T> struct fast_exp<T, 4> { static inline T result(const T v) { T v_2 = v * v; return v_2 * v_2; } };
+ template <typename T> struct fast_exp<T, 3> { static inline T result(const T v) { return v * v * v; } };
+ template <typename T> struct fast_exp<T, 2> { static inline T result(const T v) { return v * v; } };
+ template <typename T> struct fast_exp<T, 1> { static inline T result(const T v) { return v; } };
+ template <typename T> struct fast_exp<T, 0> { static inline T result(const T ) { return T(1); } };
#define exprtk_define_unary_function(FunctionName) \
template <typename T> \
@@ -1716,7 +1709,7 @@
bool return_result = true;
unsigned int digit = 0;
- const std::size_t length = static_cast<std::size_t>(std::distance(itr,end));
+ const std::size_t length = static_cast<std::size_t>(std::distance(itr,end));
if (length <= 4)
{
@@ -1747,10 +1740,14 @@
#endif
- case 4 : exprtk_process_digit
- case 3 : exprtk_process_digit
- case 2 : exprtk_process_digit
- case 1 : if ((digit = (*itr - zero))>= 10) { digit = 0; return_result = false; }
+ case 4 : exprtk_process_digit
+ case 3 : exprtk_process_digit
+ case 2 : exprtk_process_digit
+ case 1 : if ((digit = (*itr - zero))>= 10)
+ {
+ digit = 0;
+ return_result = false;
+ }
#undef exprtk_process_digit
}
@@ -1803,7 +1800,7 @@
}
template <typename Iterator, typename T>
- static inline bool parse_inf(Iterator& itr, const Iterator end, T& t, bool negative)
+ static inline bool parse_inf(Iterator& itr, const Iterator end, T& t, const bool negative)
{
static const char_t inf_uc[] = "INFINITY";
static const char_t inf_lc[] = "infinity";
@@ -1818,7 +1815,7 @@
while (end != itr)
{
- if (*inf_itr == static_cast<char>(*itr))
+ if (*inf_itr == static_cast<char_t>(*itr))
{
++itr;
++inf_itr;
@@ -1839,8 +1836,8 @@
template <typename T>
inline bool valid_exponent(const int exponent, numeric::details::real_type_tag)
{
- return (std::numeric_limits<T>::min_exponent10 <= exponent) &&
- (exponent <= std::numeric_limits<T>::max_exponent10) ;
+ using namespace details::numeric;
+ return (numeric_info<T>::min_exp <= exponent) && (exponent <= numeric_info<T>::max_exp);
}
template <typename Iterator, typename T>
@@ -1874,7 +1871,8 @@
#define parse_digit_2(d) \
if ((digit = (*itr - zero)) < 10) \
{ d = d * T(10) + digit; } \
- else { break; } \
+ else \
+ { break; } \
++itr; \
if ('.' != (*itr))
@@ -1885,14 +1883,7 @@
while (end != itr)
{
- // Note: For 'physical' superscalar architectures it
- // is advised that the following loop be: 4xPD1 and 1xPD2
unsigned int digit;
-
- #ifdef exprtk_enable_superscalar
- parse_digit_1(d)
- parse_digit_1(d)
- #endif
parse_digit_1(d)
parse_digit_1(d)
parse_digit_2(d)
@@ -1913,12 +1904,6 @@
while (end != itr)
{
unsigned int digit;
-
- #ifdef exprtk_enable_superscalar
- parse_digit_1(tmp_d)
- parse_digit_1(tmp_d)
- parse_digit_1(tmp_d)
- #endif
parse_digit_1(tmp_d)
parse_digit_1(tmp_d)
parse_digit_2(tmp_d)
@@ -1928,12 +1913,12 @@
{
instate = true;
- const int exponent = static_cast<int>(-std::distance(curr, itr));
+ const int frac_exponent = static_cast<int>(-std::distance(curr, itr));
- if (!valid_exponent<T>(exponent, numeric::details::real_type_tag()))
+ if (!valid_exponent<T>(frac_exponent, numeric::details::real_type_tag()))
return false;
- d += compute_pow10(tmp_d, exponent);
+ d += compute_pow10(tmp_d, frac_exponent);
}
#undef parse_digit_1
@@ -2065,8 +2050,8 @@
loop_types loop_set;
loop_runtime_check()
- : loop_set(e_invalid),
- max_loop_iterations(0)
+ : loop_set(e_invalid)
+ , max_loop_iterations(0)
{}
details::_uint64_t max_loop_iterations;
@@ -2111,9 +2096,9 @@
};
token()
- : type(e_none),
- value(""),
- position(std::numeric_limits<std::size_t>::max())
+ : type(e_none)
+ , value("")
+ , position(std::numeric_limits<std::size_t>::max())
{}
void clear()
@@ -2272,9 +2257,9 @@
typedef details::char_t char_t;
generator()
- : base_itr_(0),
- s_itr_ (0),
- s_end_ (0)
+ : base_itr_(0)
+ , s_itr_ (0)
+ , s_end_ (0)
{
clear();
}
@@ -2390,10 +2375,10 @@
}
}
- inline std::string substr(const std::size_t& begin, const std::size_t& end)
+ inline std::string substr(const std::size_t& begin, const std::size_t& end) const
{
const details::char_cptr begin_itr = ((base_itr_ + begin) < s_end_) ? (base_itr_ + begin) : s_end_;
- const details::char_cptr end_itr = ((base_itr_ + end) < s_end_) ? (base_itr_ + end) : s_end_;
+ const details::char_cptr end_itr = ((base_itr_ + end ) < s_end_) ? (base_itr_ + end ) : s_end_;
return std::string(begin_itr,end_itr);
}
@@ -2410,14 +2395,14 @@
private:
- inline bool is_end(details::char_cptr itr)
+ inline bool is_end(details::char_cptr itr) const
{
return (s_end_ == itr);
}
- inline bool is_comment_start(details::char_cptr itr)
+ #ifndef exprtk_disable_comments
+ inline bool is_comment_start(details::char_cptr itr) const
{
- #ifndef exprtk_disable_comments
const char_t c0 = *(itr + 0);
const char_t c1 = *(itr + 1);
@@ -2428,9 +2413,14 @@
if (('/' == c0) && ('/' == c1)) return true;
if (('/' == c0) && ('*' == c1)) return true;
}
- #endif
return false;
}
+ #else
+ inline bool is_comment_start(details::char_cptr) const
+ {
+ return false;
+ }
+ #endif
inline void skip_whitespace()
{
@@ -2452,10 +2442,10 @@
static inline bool comment_start(const char_t c0, const char_t c1, int& mode, int& incr)
{
mode = 0;
- if ('#' == c0) { mode = 1; incr = 1; }
+ if ('#' == c0) { mode = 1; incr = 1; }
else if ('/' == c0)
{
- if ('/' == c1) { mode = 1; incr = 2; }
+ if ('/' == c1) { mode = 1; incr = 2; }
else if ('*' == c1) { mode = 2; incr = 2; }
}
return (0 != mode);
@@ -2598,7 +2588,7 @@
token_t::token_type ttype = token_t::e_none;
- if ((c0 == '<') && (c1 == '=')) ttype = token_t::e_lte;
+ if ((c0 == '<') && (c1 == '=')) ttype = token_t::e_lte;
else if ((c0 == '>') && (c1 == '=')) ttype = token_t::e_gte;
else if ((c0 == '<') && (c1 == '>')) ttype = token_t::e_ne;
else if ((c0 == '!') && (c1 == '=')) ttype = token_t::e_ne;
@@ -2785,7 +2775,10 @@
// $fdd(x,x,x) = at least 11 chars
if (std::distance(s_itr_,s_end_) < 11)
{
- t.set_error(token::e_err_sfunc, initial_itr, s_itr_, base_itr_);
+ t.set_error(
+ token::e_err_sfunc,
+ initial_itr, std::min(initial_itr + 11, s_end_),
+ base_itr_);
token_list_.push_back(t);
return;
@@ -2798,7 +2791,10 @@
(details::is_digit(*(s_itr_ + 3))))
)
{
- t.set_error(token::e_err_sfunc, initial_itr, s_itr_, base_itr_);
+ t.set_error(
+ token::e_err_sfunc,
+ initial_itr, std::min(initial_itr + 4, s_end_),
+ base_itr_);
token_list_.push_back(t);
return;
@@ -2930,7 +2926,7 @@
friend class token_modifier;
friend class token_inserter;
friend class token_joiner;
- };
+ }; // class generator
class helper_interface
{
@@ -2947,8 +2943,7 @@
{
public:
- virtual ~token_scanner()
- {}
+ virtual ~token_scanner() {}
explicit token_scanner(const std::size_t& stride)
: stride_(stride)
@@ -2959,7 +2954,7 @@
}
}
- inline std::size_t process(generator& g)
+ inline std::size_t process(generator& g) exprtk_override
{
if (g.token_list_.size() >= stride_)
{
@@ -3048,13 +3043,13 @@
private:
const std::size_t stride_;
- };
+ }; // class token_scanner
class token_modifier : public helper_interface
{
public:
- inline std::size_t process(generator& g)
+ inline std::size_t process(generator& g) exprtk_override
{
std::size_t changes = 0;
@@ -3082,7 +3077,7 @@
}
}
- inline std::size_t process(generator& g)
+ inline std::size_t process(generator& g) exprtk_override
{
if (g.token_list_.empty())
return 0;
@@ -3186,7 +3181,7 @@
: stride_(stride)
{}
- inline std::size_t process(generator& g)
+ inline std::size_t process(generator& g) exprtk_override
{
if (g.token_list_.empty())
return 0;
@@ -3232,13 +3227,15 @@
i+=2;
- if (static_cast<std::size_t>(i) >= g.token_list_.size())
+ if (static_cast<std::size_t>(i) >= (g.token_list_.size() - 1))
break;
}
}
token_list.push_back(g.token_list_.back());
+ assert(token_list.size() <= g.token_list_.size());
+
std::swap(token_list, g.token_list_);
return changes;
@@ -3272,7 +3269,7 @@
i+=3;
- if (static_cast<std::size_t>(i) >= g.token_list_.size())
+ if (static_cast<std::size_t>(i) >= (g.token_list_.size() - 2))
break;
}
}
@@ -3280,6 +3277,8 @@
token_list.push_back(*(g.token_list_.begin() + g.token_list_.size() - 2));
token_list.push_back(*(g.token_list_.begin() + g.token_list_.size() - 1));
+ assert(token_list.size() <= g.token_list_.size());
+
std::swap(token_list, g.token_list_);
return changes;
@@ -3345,7 +3344,7 @@
return -1;
}
}
- if ((t0.type == lexer::token::e_number ) && (t1.type == lexer::token::e_symbol )) match = true;
+ if ((t0.type == lexer::token::e_number ) && (t1.type == lexer::token::e_symbol )) match = true;
else if ((t0.type == lexer::token::e_number ) && (t1.type == lexer::token::e_lbracket )) match = true;
else if ((t0.type == lexer::token::e_number ) && (t1.type == lexer::token::e_lcrlbracket)) match = true;
else if ((t0.type == lexer::token::e_number ) && (t1.type == lexer::token::e_lsqrbracket)) match = true;
@@ -3458,7 +3457,7 @@
return true;
}
// '! =' --> '!='
- else if ((static_cast<char>(t0.type) == '!') && (t1.type == lexer::token::e_eq))
+ else if ((static_cast<details::char_t>(t0.type) == '!') && (t1.type == lexer::token::e_eq))
{
t.type = lexer::token::e_ne;
t.value = "!=";
@@ -3519,7 +3518,10 @@
return false;
}
- inline bool join(const lexer::token& t0, const lexer::token& t1, const lexer::token& t2, lexer::token& t)
+ inline bool join(const lexer::token& t0,
+ const lexer::token& t1,
+ const lexer::token& t2,
+ lexer::token& t)
{
// '[ * ]' --> '[*]'
if (
@@ -3546,8 +3548,8 @@
using lexer::token_scanner::operator();
bracket_checker()
- : token_scanner(1),
- state_(true)
+ : token_scanner(1)
+ , state_(true)
{}
bool result()
@@ -3590,7 +3592,7 @@
{
details::char_t c = t.value[0];
- if (t.type == lexer::token::e_lbracket ) stack_.push(std::make_pair(')',t.position));
+ if (t.type == lexer::token::e_lbracket ) stack_.push(std::make_pair(')',t.position));
else if (t.type == lexer::token::e_lcrlbracket) stack_.push(std::make_pair('}',t.position));
else if (t.type == lexer::token::e_lsqrbracket) stack_.push(std::make_pair(']',t.position));
else if (exprtk::details::is_right_bracket(c))
@@ -3631,8 +3633,8 @@
using lexer::token_scanner::operator();
numeric_checker()
- : token_scanner (1),
- current_index_(0)
+ : token_scanner (1)
+ , current_index_(0)
{}
bool result()
@@ -3839,12 +3841,12 @@
private:
- void add_invalid(lexer::token::token_type base, lexer::token::token_type t)
+ void add_invalid(const lexer::token::token_type base, const lexer::token::token_type t)
{
invalid_comb_.insert(std::make_pair(base,t));
}
- void add_invalid_set1(lexer::token::token_type t)
+ void add_invalid_set1(const lexer::token::token_type t)
{
add_invalid(t, lexer::token::e_assign);
add_invalid(t, lexer::token::e_shr );
@@ -3863,9 +3865,9 @@
add_invalid(t, lexer::token::e_colon );
}
- bool invalid_bracket_check(lexer::token::token_type base, lexer::token::token_type t)
+ bool invalid_bracket_check(const lexer::token::token_type base, const lexer::token::token_type t)
{
- if (details::is_right_bracket(static_cast<char>(base)))
+ if (details::is_right_bracket(static_cast<details::char_t>(base)))
{
switch (t)
{
@@ -3874,11 +3876,11 @@
default : return false;
}
}
- else if (details::is_left_bracket(static_cast<char>(base)))
+ else if (details::is_left_bracket(static_cast<details::char_t>(base)))
{
- if (details::is_right_bracket(static_cast<char>(t)))
+ if (details::is_right_bracket(static_cast<details::char_t>(t)))
return false;
- else if (details::is_left_bracket(static_cast<char>(t)))
+ else if (details::is_left_bracket(static_cast<details::char_t>(t)))
return false;
else
{
@@ -3895,7 +3897,7 @@
}
}
}
- else if (details::is_right_bracket(static_cast<char>(t)))
+ else if (details::is_right_bracket(static_cast<details::char_t>(t)))
{
switch (base)
{
@@ -3908,7 +3910,7 @@
default : return true ;
}
}
- else if (details::is_left_bracket(static_cast<char>(t)))
+ else if (details::is_left_bracket(static_cast<details::char_t>(t)))
{
switch (base)
{
@@ -3941,23 +3943,23 @@
sequence_validator_3tokens()
: lexer::token_scanner(3)
{
- add_invalid(lexer::token::e_number, lexer::token::e_number, lexer::token::e_number);
- add_invalid(lexer::token::e_string, lexer::token::e_string, lexer::token::e_string);
- add_invalid(lexer::token::e_comma , lexer::token::e_comma , lexer::token::e_comma );
+ add_invalid(lexer::token::e_number , lexer::token::e_number , lexer::token::e_number);
+ add_invalid(lexer::token::e_string , lexer::token::e_string , lexer::token::e_string);
+ add_invalid(lexer::token::e_comma , lexer::token::e_comma , lexer::token::e_comma );
- add_invalid(lexer::token::e_add , lexer::token::e_add , lexer::token::e_add );
- add_invalid(lexer::token::e_sub , lexer::token::e_sub , lexer::token::e_sub );
- add_invalid(lexer::token::e_div , lexer::token::e_div , lexer::token::e_div );
- add_invalid(lexer::token::e_mul , lexer::token::e_mul , lexer::token::e_mul );
- add_invalid(lexer::token::e_mod , lexer::token::e_mod , lexer::token::e_mod );
- add_invalid(lexer::token::e_pow , lexer::token::e_pow , lexer::token::e_pow );
+ add_invalid(lexer::token::e_add , lexer::token::e_add , lexer::token::e_add );
+ add_invalid(lexer::token::e_sub , lexer::token::e_sub , lexer::token::e_sub );
+ add_invalid(lexer::token::e_div , lexer::token::e_div , lexer::token::e_div );
+ add_invalid(lexer::token::e_mul , lexer::token::e_mul , lexer::token::e_mul );
+ add_invalid(lexer::token::e_mod , lexer::token::e_mod , lexer::token::e_mod );
+ add_invalid(lexer::token::e_pow , lexer::token::e_pow , lexer::token::e_pow );
- add_invalid(lexer::token::e_add , lexer::token::e_sub , lexer::token::e_add );
- add_invalid(lexer::token::e_sub , lexer::token::e_add , lexer::token::e_sub );
- add_invalid(lexer::token::e_div , lexer::token::e_mul , lexer::token::e_div );
- add_invalid(lexer::token::e_mul , lexer::token::e_div , lexer::token::e_mul );
- add_invalid(lexer::token::e_mod , lexer::token::e_pow , lexer::token::e_mod );
- add_invalid(lexer::token::e_pow , lexer::token::e_mod , lexer::token::e_pow );
+ add_invalid(lexer::token::e_add , lexer::token::e_sub , lexer::token::e_add );
+ add_invalid(lexer::token::e_sub , lexer::token::e_add , lexer::token::e_sub );
+ add_invalid(lexer::token::e_div , lexer::token::e_mul , lexer::token::e_div );
+ add_invalid(lexer::token::e_mul , lexer::token::e_div , lexer::token::e_mul );
+ add_invalid(lexer::token::e_mod , lexer::token::e_pow , lexer::token::e_mod );
+ add_invalid(lexer::token::e_pow , lexer::token::e_mod , lexer::token::e_pow );
}
bool result()
@@ -4002,7 +4004,7 @@
private:
- void add_invalid(token_t t0, token_t t1, token_t t2)
+ void add_invalid(const token_t t0, const token_t t1, const token_t t2)
{
invalid_comb_.insert(std::make_pair(t0,std::make_pair(t1,t2)));
}
@@ -4173,7 +4175,7 @@
{
public:
- typedef token token_t;
+ typedef token token_t;
typedef generator generator_t;
inline bool init(const std::string& str)
@@ -4291,15 +4293,15 @@
typedef T* data_ptr_t;
vector_view(data_ptr_t data, const std::size_t& size)
- : size_(size),
- data_(data),
- data_ref_(0)
+ : size_(size)
+ , data_(data)
+ , data_ref_(0)
{}
vector_view(const vector_view<T>& vv)
- : size_(vv.size_),
- data_(vv.data_),
- data_ref_(0)
+ : size_(vv.size_)
+ , data_(vv.data_)
+ , data_ref_(0)
{}
inline void rebase(data_ptr_t data)
@@ -4375,15 +4377,15 @@
};
type_store()
- : data(0),
- size(0),
- type(e_unknown)
+ : data(0)
+ , size(0)
+ , type(e_unknown)
{}
union
{
- void* data;
- T* vec_data;
+ void* data;
+ T* vec_data;
};
std::size_t size;
@@ -4393,7 +4395,7 @@
{
public:
- parameter_list(std::vector<type_store>& pl)
+ explicit parameter_list(std::vector<type_store>& pl)
: parameter_list_(pl)
{}
@@ -4450,14 +4452,14 @@
typedef type_store<T> type_store_t;
typedef ViewType value_t;
- type_view(type_store_t& ts)
- : ts_(ts),
- data_(reinterpret_cast<value_t*>(ts_.data))
+ explicit type_view(type_store_t& ts)
+ : ts_(ts)
+ , data_(reinterpret_cast<value_t*>(ts_.data))
{}
- type_view(const type_store_t& ts)
- : ts_(const_cast<type_store_t&>(ts)),
- data_(reinterpret_cast<value_t*>(ts_.data))
+ explicit type_view(const type_store_t& ts)
+ : ts_(const_cast<type_store_t&>(ts))
+ , data_(reinterpret_cast<value_t*>(ts_.data))
{}
inline std::size_t size() const
@@ -4500,11 +4502,11 @@
typedef type_store<T> type_store_t;
typedef T value_t;
- scalar_view(type_store_t& ts)
+ explicit scalar_view(type_store_t& ts)
: v_(*reinterpret_cast<value_t*>(ts.data))
{}
- scalar_view(const type_store_t& ts)
+ explicit scalar_view(const type_store_t& ts)
: v_(*reinterpret_cast<value_t*>(const_cast<type_store_t&>(ts).data))
{}
@@ -4725,8 +4727,8 @@
struct base_operation_t
{
base_operation_t(const operator_type t, const unsigned int& np)
- : type(t),
- num_params(np)
+ : type(t)
+ , num_params(np)
{}
operator_type type;
@@ -4745,13 +4747,13 @@
{
explicit details(const std::size_t& vsize,
const unsigned int loop_batch_size = global_loop_batch_size)
- : batch_size(loop_batch_size ),
- remainder (vsize % batch_size),
- upper_bound(static_cast<int>(vsize - (remainder ? loop_batch_size : 0)))
+ : batch_size(loop_batch_size )
+ , remainder (vsize % batch_size)
+ , upper_bound(static_cast<int>(vsize - (remainder ? loop_batch_size : 0)))
{}
unsigned int batch_size;
- int remainder;
+ int remainder;
int upper_bound;
};
}
@@ -4785,24 +4787,24 @@
struct control_block
{
control_block()
- : ref_count(1),
- size (0),
- data (0),
- destruct (true)
+ : ref_count(1)
+ , size (0)
+ , data (0)
+ , destruct (true)
{}
- control_block(const std::size_t& dsize)
- : ref_count(1 ),
- size (dsize),
- data (0 ),
- destruct (true )
+ explicit control_block(const std::size_t& dsize)
+ : ref_count(1 )
+ , size (dsize)
+ , data (0 )
+ , destruct (true )
{ create_data(); }
control_block(const std::size_t& dsize, data_t dptr, bool dstrct = false)
- : ref_count(1 ),
- size (dsize ),
- data (dptr ),
- destruct (dstrct)
+ : ref_count(1 )
+ , size (dsize )
+ , data (dptr )
+ , destruct (dstrct)
{}
~control_block()
@@ -4851,15 +4853,15 @@
private:
- control_block(const control_block&);
- control_block& operator=(const control_block&);
+ control_block(const control_block&) exprtk_delete;
+ control_block& operator=(const control_block&) exprtk_delete;
inline void create_data()
{
destruct = true;
data = new T[size];
std::fill_n(data, size, T(0));
- dump_ptr("control_block::create_data() - data",data,size);
+ dump_ptr("control_block::create_data() - data", data, size);
}
};
@@ -4869,8 +4871,8 @@
: control_block_(control_block::create(0))
{}
- vec_data_store(const std::size_t& size)
- : control_block_(control_block::create(size,(data_t)(0),true))
+ explicit vec_data_store(const std::size_t& size)
+ : control_block_(control_block::create(size,reinterpret_cast<data_t>(0),true))
{}
vec_data_store(const std::size_t& size, data_t data, bool dstrct = false)
@@ -4919,11 +4921,6 @@
return control_block_->data;
}
- inline std::size_t size()
- {
- return control_block_->size;
- }
-
inline std::size_t size() const
{
return control_block_->size;
@@ -4962,7 +4959,7 @@
private:
- static inline std::size_t min_size(control_block* cb0, control_block* cb1)
+ static inline std::size_t min_size(const control_block* cb0, const control_block* cb1)
{
const std::size_t size0 = cb0->size;
const std::size_t size1 = cb1->size;
@@ -5181,8 +5178,8 @@
e_vecdefass , e_vecvalass , e_vecvecass , e_vecopvalass ,
e_vecopvecass , e_vecfunc , e_vecvecswap , e_vecvecineq ,
e_vecvalineq , e_valvecineq , e_vecvecarith , e_vecvalarith ,
- e_valvecarith , e_vecunaryop , e_break , e_continue ,
- e_swap
+ e_valvecarith , e_vecunaryop , e_vecondition , e_break ,
+ e_continue , e_swap
};
typedef T value_type;
@@ -5191,8 +5188,7 @@
typedef typename nci_t::noderef_list_t noderef_list_t;
typedef node_depth_base<expression_node<T> > ndb_t;
- virtual ~expression_node()
- {}
+ virtual ~expression_node() {}
inline virtual T value() const
{
@@ -5208,7 +5204,7 @@
{
return e_none;
}
- };
+ }; // class expression_node
template <typename T>
inline bool is_generally_string_node(const expression_node<T>* node);
@@ -5334,7 +5330,8 @@
case details::expression_node<T>::e_vecvecarith :
case details::expression_node<T>::e_vecvalarith :
case details::expression_node<T>::e_valvecarith :
- case details::expression_node<T>::e_vecunaryop : return true;
+ case details::expression_node<T>::e_vecunaryop :
+ case details::expression_node<T>::e_vecondition : return true;
default : return false;
}
}
@@ -5577,9 +5574,12 @@
template <typename Node>
struct node_depth_base
{
+ typedef Node* node_ptr_t;
+ typedef std::pair<node_ptr_t,bool> nb_pair_t;
+
node_depth_base()
- : depth_set(false),
- depth(0)
+ : depth_set(false)
+ , depth(0)
{}
virtual ~node_depth_base() {}
@@ -5597,7 +5597,7 @@
return depth;
}
- std::size_t compute_node_depth(const std::pair<Node*,bool>& branch) const
+ std::size_t compute_node_depth(const nb_pair_t& branch) const
{
if (!depth_set)
{
@@ -5609,7 +5609,7 @@
}
template <std::size_t N>
- std::size_t compute_node_depth(const std::pair<Node*,bool> (&branch)[N]) const
+ std::size_t compute_node_depth(const nb_pair_t (&branch)[N]) const
{
if (!depth_set)
{
@@ -5672,7 +5672,7 @@
template <typename Allocator,
template <typename, typename> class Sequence>
- std::size_t compute_node_depth(const Sequence<Node*, Allocator>& branch_list) const
+ std::size_t compute_node_depth(const Sequence<node_ptr_t, Allocator>& branch_list) const
{
if (!depth_set)
{
@@ -5691,7 +5691,7 @@
template <typename Allocator,
template <typename, typename> class Sequence>
- std::size_t compute_node_depth(const Sequence<std::pair<Node*,bool>,Allocator>& branch_list) const
+ std::size_t compute_node_depth(const Sequence<nb_pair_t,Allocator>& branch_list) const
{
if (!depth_set)
{
@@ -5712,18 +5712,18 @@
mutable std::size_t depth;
template <typename NodeSequence>
- void collect(Node*const& node,
+ void collect(node_ptr_t const& node,
const bool deletable,
NodeSequence& delete_node_list) const
{
if ((0 != node) && deletable)
{
- delete_node_list.push_back(const_cast<Node**>(&node));
+ delete_node_list.push_back(const_cast<node_ptr_t*>(&node));
}
}
template <typename NodeSequence>
- void collect(const std::pair<Node*, bool>& branch,
+ void collect(const nb_pair_t& branch,
NodeSequence& delete_node_list) const
{
collect(branch.first, branch.second, delete_node_list);
@@ -5737,7 +5737,7 @@
}
template <std::size_t N, typename NodeSequence>
- void collect(const std::pair<Node*, bool>(&branch)[N],
+ void collect(const nb_pair_t(&branch)[N],
NodeSequence& delete_node_list) const
{
for (std::size_t i = 0; i < N; ++i)
@@ -5749,7 +5749,7 @@
template <typename Allocator,
template <typename, typename> class Sequence,
typename NodeSequence>
- void collect(const Sequence<std::pair<Node*, bool>, Allocator>& branch,
+ void collect(const Sequence<nb_pair_t, Allocator>& branch,
NodeSequence& delete_node_list) const
{
for (std::size_t i = 0; i < branch.size(); ++i)
@@ -5761,7 +5761,7 @@
template <typename Allocator,
template <typename, typename> class Sequence,
typename NodeSequence>
- void collect(const Sequence<Node*, Allocator>& branch_list,
+ void collect(const Sequence<node_ptr_t, Allocator>& branch_list,
NodeSequence& delete_node_list) const
{
for (std::size_t i = 0; i < branch_list.size(); ++i)
@@ -5775,7 +5775,7 @@
typename AllocatorB,
template <typename, typename> class Sequence,
typename NodeSequence>
- void collect(const Sequence<Node*, AllocatorT>& branch_list,
+ void collect(const Sequence<node_ptr_t, AllocatorT>& branch_list,
const Sequence<Boolean, AllocatorB>& branch_deletable_list,
NodeSequence& delete_node_list) const
{
@@ -5834,8 +5834,8 @@
public:
array_vector_impl(const Type* vec, const std::size_t& vec_size)
- : vec_(vec),
- size_(vec_size)
+ : vec_(vec)
+ , size_(vec_size)
{}
protected:
@@ -5855,7 +5855,8 @@
private:
- array_vector_impl operator=(const array_vector_impl&);
+ array_vector_impl(const array_vector_impl&) exprtk_delete;
+ array_vector_impl& operator=(const array_vector_impl&) exprtk_delete;
const Type* vec_;
const std::size_t size_;
@@ -5887,7 +5888,8 @@
private:
- sequence_vector_impl operator=(const sequence_vector_impl&);
+ sequence_vector_impl(const sequence_vector_impl&) exprtk_delete;
+ sequence_vector_impl& operator=(const sequence_vector_impl&) exprtk_delete;
sequence_t& sequence_;
};
@@ -5926,7 +5928,8 @@
private:
- vector_view_impl operator=(const vector_view_impl&);
+ vector_view_impl(const vector_view_impl&) exprtk_delete;
+ vector_view_impl& operator=(const vector_view_impl&) exprtk_delete;
vector_view_t& vec_view_;
};
@@ -5984,16 +5987,16 @@
};
template <typename T>
- class null_node : public expression_node<T>
+ class null_node exprtk_final : public expression_node<T>
{
public:
- inline T value() const
+ inline T value() const exprtk_override
{
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_null;
}
@@ -6045,7 +6048,7 @@
}
template <typename T>
- class null_eq_node : public expression_node<T>
+ class null_eq_node exprtk_final : public expression_node<T>
{
public:
@@ -6058,7 +6061,7 @@
construct_branch_pair(branch_, branch);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(branch_.first);
@@ -6071,27 +6074,22 @@
return (equality_) ? T(0) : T(1);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_nulleq;
}
- inline operator_type operation() const
- {
- return details::e_eq;
- }
-
- inline expression_node<T>* branch(const std::size_t&) const
+ inline expression_node<T>* branch(const std::size_t&) const exprtk_override
{
return branch_.first;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
- expression_node<T>::ndb_t::collect(branch_,node_delete_list);
+ expression_node<T>::ndb_t::collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
@@ -6103,7 +6101,7 @@
};
template <typename T>
- class literal_node : public expression_node<T>
+ class literal_node exprtk_final : public expression_node<T>
{
public:
@@ -6111,25 +6109,25 @@
: value_(v)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return value_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_constant;
}
- inline expression_node<T>* branch(const std::size_t&) const
+ inline expression_node<T>* branch(const std::size_t&) const exprtk_override
{
return reinterpret_cast<expression_node<T>*>(0);
}
private:
- literal_node(literal_node<T>&) {}
- literal_node<T>& operator=(literal_node<T>&) { return (*this); }
+ literal_node(const literal_node<T>&) exprtk_delete;
+ literal_node<T>& operator=(const literal_node<T>&) exprtk_delete;
const T value_;
};
@@ -6147,8 +6145,7 @@
typedef range_pack<T> range_t;
- virtual ~range_interface()
- {}
+ virtual ~range_interface() {}
virtual range_t& range_ref() = 0;
@@ -6163,8 +6160,7 @@
typedef range_data_type<T> range_data_type_t;
- virtual ~string_base_node()
- {}
+ virtual ~string_base_node() {}
virtual std::string str () const = 0;
@@ -6174,7 +6170,8 @@
};
template <typename T>
- class string_literal_node : public expression_node <T>,
+ class string_literal_node exprtk_final
+ : public expression_node <T>,
public string_base_node<T>,
public range_interface <T>
{
@@ -6191,50 +6188,50 @@
rp_.cache.second = rp_.n1_c.second;
}
- inline T value() const
+ inline T value() const exprtk_override
{
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_stringconst;
}
- inline expression_node<T>* branch(const std::size_t&) const
+ inline expression_node<T>* branch(const std::size_t&) const exprtk_override
{
return reinterpret_cast<expression_node<T>*>(0);
}
- std::string str() const
+ std::string str() const exprtk_override
{
return value_;
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return value_.data();
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return value_.size();
}
- range_t& range_ref()
+ range_t& range_ref() exprtk_override
{
return rp_;
}
- const range_t& range_ref() const
+ const range_t& range_ref() const exprtk_override
{
return rp_;
}
private:
- string_literal_node(const string_literal_node<T>&);
- string_literal_node<T>& operator=(const string_literal_node<T>&);
+ string_literal_node(const string_literal_node<T>&) exprtk_delete;
+ string_literal_node<T>& operator=(const string_literal_node<T>&) exprtk_delete;
const std::string value_;
range_t rp_;
@@ -6255,7 +6252,7 @@
construct_branch_pair(branch_,branch);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(branch_.first);
@@ -6264,17 +6261,17 @@
return numeric::process<T>(operation_,arg);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_unary;
}
- inline operator_type operation() const
+ inline operator_type operation()
{
return operation_;
}
- inline expression_node<T>* branch(const std::size_t&) const
+ inline expression_node<T>* branch(const std::size_t&) const exprtk_override
{
return branch_.first;
}
@@ -6284,12 +6281,12 @@
branch_.second = false;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override exprtk_final
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
@@ -6316,7 +6313,7 @@
init_branches<2>(branch_, branch0, branch1);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(branch_[0].first);
assert(branch_[1].first);
@@ -6327,7 +6324,7 @@
return numeric::process<T>(operation_,arg0,arg1);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_binary;
}
@@ -6337,7 +6334,7 @@
return operation_;
}
- inline expression_node<T>* branch(const std::size_t& index = 0) const
+ inline expression_node<T>* branch(const std::size_t& index = 0) const exprtk_override
{
if (0 == index)
return branch_[0].first;
@@ -6347,12 +6344,12 @@
return reinterpret_cast<expression_ptr>(0);
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::template collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override exprtk_final
{
return expression_node<T>::ndb_t::template compute_node_depth<2>(branch_);
}
@@ -6364,7 +6361,7 @@
};
template <typename T, typename Operation>
- class binary_ext_node : public expression_node<T>
+ class binary_ext_node exprtk_final : public expression_node<T>
{
public:
@@ -6376,7 +6373,7 @@
init_branches<2>(branch_, branch0, branch1);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(branch_[0].first);
assert(branch_[1].first);
@@ -6387,7 +6384,7 @@
return Operation::process(arg0,arg1);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_binary_ext;
}
@@ -6397,7 +6394,7 @@
return Operation::operation();
}
- inline expression_node<T>* branch(const std::size_t& index = 0) const
+ inline expression_node<T>* branch(const std::size_t& index = 0) const exprtk_override
{
if (0 == index)
return branch_[0].first;
@@ -6407,12 +6404,12 @@
return reinterpret_cast<expression_ptr>(0);
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::template collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::template compute_node_depth<2>(branch_);
}
@@ -6439,7 +6436,7 @@
init_branches<3>(branch_, branch0, branch1, branch2);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(branch_[0].first);
assert(branch_[1].first);
@@ -6465,17 +6462,17 @@
}
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_trinary;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::template collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override exprtk_final
{
return expression_node<T>::ndb_t::template compute_node_depth<3>(branch_);
}
@@ -6504,22 +6501,22 @@
init_branches<4>(branch_, branch0, branch1, branch2, branch3);
}
- inline T value() const
+ inline T value() const exprtk_override
{
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_quaternary;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::template collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override exprtk_final
{
return expression_node<T>::ndb_t::template compute_node_depth<4>(branch_);
}
@@ -6531,7 +6528,7 @@
};
template <typename T>
- class conditional_node : public expression_node<T>
+ class conditional_node exprtk_final : public expression_node<T>
{
public:
@@ -6547,7 +6544,7 @@
construct_branch_pair(alternative_, alternative);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(condition_ .first);
assert(consequent_ .first);
@@ -6559,19 +6556,19 @@
return alternative_.first->value();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_conditional;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
- expression_node<T>::ndb_t::collect(condition_ , node_delete_list);
- expression_node<T>::ndb_t::collect(consequent_ , node_delete_list);
- expression_node<T>::ndb_t::collect(alternative_, node_delete_list);
+ expression_node<T>::ndb_t::collect(condition_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(consequent_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(alternative_ , node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth
(condition_, consequent_, alternative_);
@@ -6585,7 +6582,7 @@
};
template <typename T>
- class cons_conditional_node : public expression_node<T>
+ class cons_conditional_node exprtk_final : public expression_node<T>
{
public:
@@ -6600,7 +6597,7 @@
construct_branch_pair(consequent_, consequent);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(condition_ .first);
assert(consequent_.first);
@@ -6611,18 +6608,18 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_conditional;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
- expression_node<T>::ndb_t::collect(condition_ , node_delete_list);
- expression_node<T>::ndb_t::collect(consequent_, node_delete_list);
+ expression_node<T>::ndb_t::collect(condition_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(consequent_ , node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::
compute_node_depth(condition_, consequent_);
@@ -6640,18 +6637,17 @@
{
public:
- break_exception(const T& v)
+ explicit break_exception(const T& v)
: value(v)
{}
T value;
};
- class continue_exception
- {};
+ class continue_exception {};
template <typename T>
- class break_node : public expression_node<T>
+ class break_node exprtk_final : public expression_node<T>
{
public:
@@ -6663,25 +6659,30 @@
construct_branch_pair(return_, ret);
}
- inline T value() const
+ inline T value() const exprtk_override
{
- throw break_exception<T>(return_.first ? return_.first->value() : std::numeric_limits<T>::quiet_NaN());
+ const T result = return_.first ?
+ return_.first->value() :
+ std::numeric_limits<T>::quiet_NaN();
+
+ throw break_exception<T>(result);
+
#ifndef _MSC_VER
return std::numeric_limits<T>::quiet_NaN();
#endif
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_break;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(return_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(return_);
}
@@ -6692,11 +6693,11 @@
};
template <typename T>
- class continue_node : public expression_node<T>
+ class continue_node exprtk_final : public expression_node<T>
{
public:
- inline T value() const
+ inline T value() const exprtk_override
{
throw continue_exception();
#ifndef _MSC_VER
@@ -6704,22 +6705,24 @@
#endif
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_break;
}
};
#endif
- #ifdef exprtk_enable_runtime_checks
struct loop_runtime_checker
{
- loop_runtime_checker(loop_runtime_check_ptr loop_rt_chk = loop_runtime_check_ptr(0),
+ loop_runtime_checker(loop_runtime_check_ptr loop_runtime_check,
loop_runtime_check::loop_types lp_typ = loop_runtime_check::e_invalid)
- : iteration_count_(0),
- loop_runtime_check_(loop_rt_chk),
- loop_type(lp_typ)
- {}
+ : iteration_count_(0)
+ , loop_runtime_check_(loop_runtime_check)
+ , max_loop_iterations_(loop_runtime_check_->max_loop_iterations)
+ , loop_type_(lp_typ)
+ {
+ assert(loop_runtime_check_);
+ }
inline void reset(const _uint64_t initial_value = 0) const
{
@@ -6730,14 +6733,14 @@
{
if (
(0 == loop_runtime_check_) ||
- (++iteration_count_ <= loop_runtime_check_->max_loop_iterations)
+ (++iteration_count_ <= max_loop_iterations_)
)
{
return true;
}
loop_runtime_check::violation_context ctxt;
- ctxt.loop = loop_type;
+ ctxt.loop = loop_type_;
ctxt.violation = loop_runtime_check::e_iteration_count;
loop_runtime_check_->handle_runtime_violation(ctxt);
@@ -6747,27 +6750,12 @@
mutable _uint64_t iteration_count_;
mutable loop_runtime_check_ptr loop_runtime_check_;
- loop_runtime_check::loop_types loop_type;
+ const details::_uint64_t& max_loop_iterations_;
+ loop_runtime_check::loop_types loop_type_;
};
- #else
- struct loop_runtime_checker
- {
- loop_runtime_checker(loop_runtime_check_ptr, loop_runtime_check::loop_types)
- {}
-
- inline void reset(const _uint64_t = 0) const
- {}
-
- inline bool check() const
- {
- return true;
- }
- };
- #endif
template <typename T>
- class while_loop_node : public expression_node<T>,
- public loop_runtime_checker
+ class while_loop_node : public expression_node<T>
{
public:
@@ -6775,24 +6763,20 @@
typedef std::pair<expression_ptr,bool> branch_t;
while_loop_node(expression_ptr condition,
- expression_ptr loop_body,
- loop_runtime_check_ptr loop_rt_chk = loop_runtime_check_ptr(0))
- : loop_runtime_checker(loop_rt_chk,loop_runtime_check::e_while_loop)
+ expression_ptr loop_body)
{
construct_branch_pair(condition_, condition);
construct_branch_pair(loop_body_, loop_body);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(condition_.first);
assert(loop_body_.first);
T result = T(0);
- loop_runtime_checker::reset();
-
- while (is_true(condition_) && loop_runtime_checker::check())
+ while (is_true(condition_))
{
result = loop_body_.first->value();
}
@@ -6800,31 +6784,65 @@
return result;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_while;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
- expression_node<T>::ndb_t::collect(condition_, node_delete_list);
- expression_node<T>::ndb_t::collect(loop_body_, node_delete_list);
+ expression_node<T>::ndb_t::collect(condition_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(loop_body_ , node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(condition_, loop_body_);
}
- private:
+ protected:
branch_t condition_;
branch_t loop_body_;
};
template <typename T>
- class repeat_until_loop_node : public expression_node<T>,
- public loop_runtime_checker
+ class while_loop_rtc_node exprtk_final
+ : public while_loop_node<T>
+ , public loop_runtime_checker
+ {
+ public:
+
+ typedef while_loop_node<T> parent_t;
+ typedef expression_node<T>* expression_ptr;
+
+ while_loop_rtc_node(expression_ptr condition,
+ expression_ptr loop_body,
+ loop_runtime_check_ptr loop_rt_chk)
+ : parent_t(condition, loop_body)
+ , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_while_loop)
+ {}
+
+ inline T value() const exprtk_override
+ {
+ assert(parent_t::condition_.first);
+ assert(parent_t::loop_body_.first);
+
+ T result = T(0);
+
+ loop_runtime_checker::reset();
+
+ while (is_true(parent_t::condition_) && loop_runtime_checker::check())
+ {
+ result = parent_t::loop_body_.first->value();
+ }
+
+ return result;
+ }
+ };
+
+ template <typename T>
+ class repeat_until_loop_node : public expression_node<T>
{
public:
@@ -6832,57 +6850,88 @@
typedef std::pair<expression_ptr,bool> branch_t;
repeat_until_loop_node(expression_ptr condition,
- expression_ptr loop_body,
- loop_runtime_check_ptr loop_rt_chk = loop_runtime_check_ptr(0))
- : loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_repeat_until_loop)
+ expression_ptr loop_body)
{
construct_branch_pair(condition_, condition);
construct_branch_pair(loop_body_, loop_body);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(condition_.first);
assert(loop_body_.first);
T result = T(0);
+ do
+ {
+ result = loop_body_.first->value();
+ }
+ while (is_false(condition_.first));
+
+ return result;
+ }
+
+ inline typename expression_node<T>::node_type type() const exprtk_override
+ {
+ return expression_node<T>::e_repeat;
+ }
+
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
+ {
+ expression_node<T>::ndb_t::collect(condition_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(loop_body_ , node_delete_list);
+ }
+
+ std::size_t node_depth() const exprtk_override
+ {
+ return expression_node<T>::ndb_t::compute_node_depth(condition_, loop_body_);
+ }
+
+ protected:
+
+ branch_t condition_;
+ branch_t loop_body_;
+ };
+
+ template <typename T>
+ class repeat_until_loop_rtc_node exprtk_final
+ : public repeat_until_loop_node<T>
+ , public loop_runtime_checker
+ {
+ public:
+
+ typedef repeat_until_loop_node<T> parent_t;
+ typedef expression_node<T>* expression_ptr;
+
+ repeat_until_loop_rtc_node(expression_ptr condition,
+ expression_ptr loop_body,
+ loop_runtime_check_ptr loop_rt_chk)
+ : parent_t(condition, loop_body)
+ , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_repeat_until_loop)
+ {}
+
+ inline T value() const exprtk_override
+ {
+ assert(parent_t::condition_.first);
+ assert(parent_t::loop_body_.first);
+
+ T result = T(0);
+
loop_runtime_checker::reset(1);
do
{
- result = loop_body_.first->value();
+ result = parent_t::loop_body_.first->value();
}
- while (is_false(condition_.first) && loop_runtime_checker::check());
+ while (is_false(parent_t::condition_.first) && loop_runtime_checker::check());
return result;
}
-
- inline typename expression_node<T>::node_type type() const
- {
- return expression_node<T>::e_repeat;
- }
-
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
- {
- expression_node<T>::ndb_t::collect(condition_, node_delete_list);
- expression_node<T>::ndb_t::collect(loop_body_, node_delete_list);
- }
-
- std::size_t node_depth() const
- {
- return expression_node<T>::ndb_t::compute_node_depth(condition_, loop_body_);
- }
-
- private:
-
- branch_t condition_;
- branch_t loop_body_;
};
template <typename T>
- class for_loop_node : public expression_node<T>,
- public loop_runtime_checker
+ class for_loop_node : public expression_node<T>
{
public:
@@ -6892,9 +6941,7 @@
for_loop_node(expression_ptr initialiser,
expression_ptr condition,
expression_ptr incrementor,
- expression_ptr loop_body,
- loop_runtime_check_ptr loop_rt_chk = loop_runtime_check_ptr(0))
- : loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_for_loop)
+ expression_ptr loop_body)
{
construct_branch_pair(initialiser_, initialiser);
construct_branch_pair(condition_ , condition );
@@ -6902,21 +6949,19 @@
construct_branch_pair(loop_body_ , loop_body );
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(condition_.first);
assert(loop_body_.first);
T result = T(0);
- loop_runtime_checker::reset();
-
if (initialiser_.first)
initialiser_.first->value();
if (incrementor_.first)
{
- while (is_true(condition_) && loop_runtime_checker::check())
+ while (is_true(condition_))
{
result = loop_body_.first->value();
incrementor_.first->value();
@@ -6924,7 +6969,7 @@
}
else
{
- while (is_true(condition_) && loop_runtime_checker::check())
+ while (is_true(condition_))
{
result = loop_body_.first->value();
}
@@ -6933,26 +6978,26 @@
return result;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_for;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
- expression_node<T>::ndb_t::collect(initialiser_, node_delete_list);
- expression_node<T>::ndb_t::collect(condition_ , node_delete_list);
- expression_node<T>::ndb_t::collect(incrementor_, node_delete_list);
- expression_node<T>::ndb_t::collect(loop_body_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(initialiser_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(condition_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(incrementor_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(loop_body_ , node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth
(initialiser_, condition_, incrementor_, loop_body_);
}
- private:
+ protected:
branch_t initialiser_;
branch_t condition_ ;
@@ -6960,39 +7005,83 @@
branch_t loop_body_ ;
};
- #ifndef exprtk_disable_break_continue
template <typename T>
- class while_loop_bc_node : public expression_node<T>,
- public loop_runtime_checker
+ class for_loop_rtc_node exprtk_final
+ : public for_loop_node<T>
+ , public loop_runtime_checker
{
public:
+ typedef for_loop_node<T> parent_t;
typedef expression_node<T>* expression_ptr;
- typedef std::pair<expression_ptr,bool> branch_t;
- while_loop_bc_node(expression_ptr condition,
- expression_ptr loop_body,
- loop_runtime_check_ptr loop_rt_chk = loop_runtime_check_ptr(0))
- : loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_while_loop)
- {
- construct_branch_pair(condition_, condition);
- construct_branch_pair(loop_body_, loop_body);
- }
+ for_loop_rtc_node(expression_ptr initialiser,
+ expression_ptr condition,
+ expression_ptr incrementor,
+ expression_ptr loop_body,
+ loop_runtime_check_ptr loop_rt_chk)
+ : parent_t(initialiser, condition, incrementor, loop_body)
+ , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_for_loop)
+ {}
- inline T value() const
+ inline T value() const exprtk_override
{
- assert(condition_.first);
- assert(loop_body_.first);
+ assert(parent_t::condition_.first);
+ assert(parent_t::loop_body_.first);
T result = T(0);
loop_runtime_checker::reset();
- while (is_true(condition_) && loop_runtime_checker::check())
+ if (parent_t::initialiser_.first)
+ parent_t::initialiser_.first->value();
+
+ if (parent_t::incrementor_.first)
+ {
+ while (is_true(parent_t::condition_) && loop_runtime_checker::check())
+ {
+ result = parent_t::loop_body_.first->value();
+ parent_t::incrementor_.first->value();
+ }
+ }
+ else
+ {
+ while (is_true(parent_t::condition_) && loop_runtime_checker::check())
+ {
+ result = parent_t::loop_body_.first->value();
+ }
+ }
+
+ return result;
+ }
+ };
+
+ #ifndef exprtk_disable_break_continue
+ template <typename T>
+ class while_loop_bc_node : public while_loop_node<T>
+ {
+ public:
+
+ typedef while_loop_node<T> parent_t;
+ typedef expression_node<T>* expression_ptr;
+
+ while_loop_bc_node(expression_ptr condition,
+ expression_ptr loop_body)
+ : parent_t(condition, loop_body)
+ {}
+
+ inline T value() const exprtk_override
+ {
+ assert(parent_t::condition_.first);
+ assert(parent_t::loop_body_.first);
+
+ T result = T(0);
+
+ while (is_true(parent_t::condition_))
{
try
{
- result = loop_body_.first->value();
+ result = parent_t::loop_body_.first->value();
}
catch(const break_exception<T>& e)
{
@@ -7004,51 +7093,112 @@
return result;
}
-
- inline typename expression_node<T>::node_type type() const
- {
- return expression_node<T>::e_while;
- }
-
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
- {
- expression_node<T>::ndb_t::collect(condition_, node_delete_list);
- expression_node<T>::ndb_t::collect(loop_body_, node_delete_list);
- }
-
- std::size_t node_depth() const
- {
- return expression_node<T>::ndb_t::compute_node_depth(condition_, loop_body_);
- }
-
- private:
-
- branch_t condition_;
- branch_t loop_body_;
};
template <typename T>
- class repeat_until_loop_bc_node : public expression_node<T>,
- public loop_runtime_checker
+ class while_loop_bc_rtc_node exprtk_final
+ : public while_loop_bc_node<T>
+ , public loop_runtime_checker
{
public:
- typedef expression_node<T>* expression_ptr;
- typedef std::pair<expression_ptr,bool> branch_t;
+ typedef while_loop_bc_node<T> parent_t;
+ typedef expression_node<T>* expression_ptr;
+
+ while_loop_bc_rtc_node(expression_ptr condition,
+ expression_ptr loop_body,
+ loop_runtime_check_ptr loop_rt_chk)
+ : parent_t(condition, loop_body)
+ , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_while_loop)
+ {}
+
+ inline T value() const exprtk_override
+ {
+ assert(parent_t::condition_.first);
+ assert(parent_t::loop_body_.first);
+
+ T result = T(0);
+
+ loop_runtime_checker::reset();
+
+ while (is_true(parent_t::condition_) && loop_runtime_checker::check())
+ {
+ try
+ {
+ result = parent_t::loop_body_.first->value();
+ }
+ catch(const break_exception<T>& e)
+ {
+ return e.value;
+ }
+ catch(const continue_exception&)
+ {}
+ }
+
+ return result;
+ }
+ };
+
+ template <typename T>
+ class repeat_until_loop_bc_node : public repeat_until_loop_node<T>
+ {
+ public:
+
+ typedef repeat_until_loop_node<T> parent_t;
+ typedef expression_node<T>* expression_ptr;
repeat_until_loop_bc_node(expression_ptr condition,
- expression_ptr loop_body,
- loop_runtime_check_ptr loop_rt_chk = loop_runtime_check_ptr(0))
- : loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_repeat_until_loop)
- {
- construct_branch_pair(condition_, condition);
- construct_branch_pair(loop_body_, loop_body);
- }
+ expression_ptr loop_body)
+ : parent_t(condition, loop_body)
+ {}
- inline T value() const
+ inline T value() const exprtk_override
{
- assert(condition_.first);
- assert(loop_body_.first);
+ assert(parent_t::condition_.first);
+ assert(parent_t::loop_body_.first);
+
+ T result = T(0);
+
+ do
+ {
+ try
+ {
+ result = parent_t::loop_body_.first->value();
+ }
+ catch(const break_exception<T>& e)
+ {
+ return e.value;
+ }
+ catch(const continue_exception&)
+ {}
+ }
+ while (is_false(parent_t::condition_.first));
+
+ return result;
+ }
+ };
+
+ template <typename T>
+ class repeat_until_loop_bc_rtc_node exprtk_final
+ : public repeat_until_loop_bc_node<T>,
+ public loop_runtime_checker
+ {
+ public:
+
+ typedef repeat_until_loop_bc_node<T> parent_t;
+ typedef expression_node<T>* expression_ptr;
+
+ repeat_until_loop_bc_rtc_node(expression_ptr condition,
+ expression_ptr loop_body,
+ loop_runtime_check_ptr loop_rt_chk)
+ : parent_t(condition, loop_body)
+ , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_repeat_until_loop)
+ {}
+
+ inline T value() const exprtk_override
+ {
+ assert(parent_t::condition_.first);
+ assert(parent_t::loop_body_.first);
T result = T(0);
@@ -7058,7 +7208,7 @@
{
try
{
- result = loop_body_.first->value();
+ result = parent_t::loop_body_.first->value();
}
catch(const break_exception<T>& e)
{
@@ -7067,74 +7217,114 @@
catch(const continue_exception&)
{}
}
- while (is_false(condition_.first) && loop_runtime_checker::check());
+ while (is_false(parent_t::condition_.first) && loop_runtime_checker::check());
return result;
}
-
- inline typename expression_node<T>::node_type type() const
- {
- return expression_node<T>::e_repeat;
- }
-
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
- {
- expression_node<T>::ndb_t::collect(condition_, node_delete_list);
- expression_node<T>::ndb_t::collect(loop_body_, node_delete_list);
- }
-
- std::size_t node_depth() const
- {
- return expression_node<T>::ndb_t::compute_node_depth(condition_, loop_body_);
- }
-
- private:
-
- branch_t condition_;
- branch_t loop_body_;
};
template <typename T>
- class for_loop_bc_node : public expression_node<T>,
- public loop_runtime_checker
+ class for_loop_bc_node : public for_loop_node<T>
{
public:
+ typedef for_loop_node<T> parent_t;
typedef expression_node<T>* expression_ptr;
- typedef std::pair<expression_ptr,bool> branch_t;
for_loop_bc_node(expression_ptr initialiser,
expression_ptr condition,
expression_ptr incrementor,
- expression_ptr loop_body,
- loop_runtime_check_ptr loop_rt_chk = loop_runtime_check_ptr(0))
- : loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_for_loop)
- {
- construct_branch_pair(initialiser_, initialiser);
- construct_branch_pair(condition_ , condition );
- construct_branch_pair(incrementor_, incrementor);
- construct_branch_pair(loop_body_ , loop_body );
- }
+ expression_ptr loop_body)
+ : parent_t(initialiser, condition, incrementor, loop_body)
+ {}
- inline T value() const
+ inline T value() const exprtk_override
{
- assert(condition_.first);
- assert(loop_body_.first);
+ assert(parent_t::condition_.first);
+ assert(parent_t::loop_body_.first);
+
+ T result = T(0);
+
+ if (parent_t::initialiser_.first)
+ parent_t::initialiser_.first->value();
+
+ if (parent_t::incrementor_.first)
+ {
+ while (is_true(parent_t::condition_))
+ {
+ try
+ {
+ result = parent_t::loop_body_.first->value();
+ }
+ catch(const break_exception<T>& e)
+ {
+ return e.value;
+ }
+ catch(const continue_exception&)
+ {}
+
+ parent_t::incrementor_.first->value();
+ }
+ }
+ else
+ {
+ while (is_true(parent_t::condition_))
+ {
+ try
+ {
+ result = parent_t::loop_body_.first->value();
+ }
+ catch(const break_exception<T>& e)
+ {
+ return e.value;
+ }
+ catch(const continue_exception&)
+ {}
+ }
+ }
+
+ return result;
+ }
+ };
+
+ template <typename T>
+ class for_loop_bc_rtc_node exprtk_final
+ : public for_loop_bc_node<T>
+ , public loop_runtime_checker
+ {
+ public:
+
+ typedef for_loop_bc_node<T> parent_t;
+ typedef expression_node<T>* expression_ptr;
+
+ for_loop_bc_rtc_node(expression_ptr initialiser,
+ expression_ptr condition,
+ expression_ptr incrementor,
+ expression_ptr loop_body,
+ loop_runtime_check_ptr loop_rt_chk)
+ : parent_t(initialiser, condition, incrementor, loop_body)
+ , loop_runtime_checker(loop_rt_chk, loop_runtime_check::e_for_loop)
+ {}
+
+ inline T value() const exprtk_override
+ {
+ assert(parent_t::condition_.first);
+ assert(parent_t::loop_body_.first);
T result = T(0);
loop_runtime_checker::reset();
- if (initialiser_.first)
- initialiser_.first->value();
+ if (parent_t::initialiser_.first)
+ parent_t::initialiser_.first->value();
- if (incrementor_.first)
+ if (parent_t::incrementor_.first)
{
- while (is_true(condition_) && loop_runtime_checker::check())
+ while (is_true(parent_t::condition_) && loop_runtime_checker::check())
{
try
{
- result = loop_body_.first->value();
+ result = parent_t::loop_body_.first->value();
}
catch(const break_exception<T>& e)
{
@@ -7143,16 +7333,16 @@
catch(const continue_exception&)
{}
- incrementor_.first->value();
+ parent_t::incrementor_.first->value();
}
}
else
{
- while (is_true(condition_) && loop_runtime_checker::check())
+ while (is_true(parent_t::condition_) && loop_runtime_checker::check())
{
try
{
- result = loop_body_.first->value();
+ result = parent_t::loop_body_.first->value();
}
catch(const break_exception<T>& e)
{
@@ -7165,32 +7355,6 @@
return result;
}
-
- inline typename expression_node<T>::node_type type() const
- {
- return expression_node<T>::e_for;
- }
-
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
- {
- expression_node<T>::ndb_t::collect(initialiser_, node_delete_list);
- expression_node<T>::ndb_t::collect(condition_ , node_delete_list);
- expression_node<T>::ndb_t::collect(incrementor_, node_delete_list);
- expression_node<T>::ndb_t::collect(loop_body_ , node_delete_list);
- }
-
- std::size_t node_depth() const
- {
- return expression_node<T>::ndb_t::compute_node_depth
- (initialiser_, condition_, incrementor_, loop_body_);
- }
-
- private:
-
- branch_t initialiser_;
- branch_t condition_ ;
- branch_t incrementor_;
- branch_t loop_body_ ;
};
#endif
@@ -7225,7 +7389,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (!arg_list_.empty())
{
@@ -7248,17 +7412,17 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override exprtk_final
{
return expression_node<T>::e_switch;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(arg_list_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override exprtk_final
{
return expression_node<T>::ndb_t::compute_node_depth(arg_list_);
}
@@ -7269,7 +7433,7 @@
};
template <typename T, typename Switch_N>
- class switch_n_node : public switch_node<T>
+ class switch_n_node exprtk_final : public switch_node<T>
{
public:
@@ -7281,14 +7445,14 @@
: switch_node<T>(arg_list)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return Switch_N::process(switch_node<T>::arg_list_);
}
};
template <typename T>
- class multi_switch_node : public expression_node<T>
+ class multi_switch_node exprtk_final : public expression_node<T>
{
public:
@@ -7318,7 +7482,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
T result = T(0);
@@ -7343,17 +7507,17 @@
return result;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_mswitch;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(arg_list_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override exprtk_final
{
return expression_node<T>::ndb_t::compute_node_depth(arg_list_);
}
@@ -7368,15 +7532,15 @@
{
public:
- virtual ~ivariable()
- {}
+ virtual ~ivariable() {}
virtual T& ref() = 0;
virtual const T& ref() const = 0;
};
template <typename T>
- class variable_node : public expression_node<T>,
+ class variable_node exprtk_final
+ : public expression_node<T>,
public ivariable <T>
{
public:
@@ -7396,22 +7560,22 @@
return this < (&v);
}
- inline T value() const
+ inline T value() const exprtk_override
{
return (*value_);
}
- inline T& ref()
+ inline T& ref() exprtk_override
{
return (*value_);
}
- inline const T& ref() const
+ inline const T& ref() const exprtk_override
{
return (*value_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_variable;
}
@@ -7431,11 +7595,11 @@
typedef std::pair<std::size_t,std::size_t> cached_range_t;
range_pack()
- : n0_e (std::make_pair(false,expression_node_ptr(0))),
- n1_e (std::make_pair(false,expression_node_ptr(0))),
- n0_c (std::make_pair(false,0)),
- n1_c (std::make_pair(false,0)),
- cache(std::make_pair(0,0))
+ : n0_e (std::make_pair(false,expression_node_ptr(0)))
+ , n1_e (std::make_pair(false,expression_node_ptr(0)))
+ , n0_c (std::make_pair(false,0))
+ , n1_c (std::make_pair(false,0))
+ , cache(std::make_pair(0,0))
{}
void clear()
@@ -7520,7 +7684,7 @@
cache.first = r0;
cache.second = r1;
- #ifndef exprtk_enable_runtime_checks
+ #ifndef exprtk_enable_range_runtime_checks
return (r0 <= r1);
#else
return range_runtime_check(r0, r1, size);
@@ -7543,18 +7707,18 @@
std::pair<bool,std::size_t > n1_c;
mutable cached_range_t cache;
- #ifdef exprtk_enable_runtime_checks
+ #ifdef exprtk_enable_range_runtime_checks
bool range_runtime_check(const std::size_t r0,
const std::size_t r1,
const std::size_t size) const
{
- if ((r0 < 0) || (r0 >= size))
+ if (r0 >= size)
{
throw std::runtime_error("range error: (r0 < 0) || (r0 >= size)");
return false;
}
- if ((r1 < 0) || (r1 >= size))
+ if (r1 >= size)
{
throw std::runtime_error("range error: (r1 < 0) || (r1 >= size)");
return false;
@@ -7575,11 +7739,11 @@
typedef string_base_node<T>* strbase_ptr_t;
range_data_type()
- : range(0),
- data (0),
- size (0),
- type_size(0),
- str_node (0)
+ : range(0)
+ , data (0)
+ , size (0)
+ , type_size(0)
+ , str_node (0)
{}
range_t* range;
@@ -7597,10 +7761,9 @@
public:
typedef vector_node<T>* vector_node_ptr;
- typedef vec_data_store<T> vds_t;
+ typedef vec_data_store<T> vds_t;
- virtual ~vector_interface()
- {}
+ virtual ~vector_interface() {}
virtual std::size_t size () const = 0;
@@ -7616,59 +7779,60 @@
};
template <typename T>
- class vector_node : public expression_node <T>,
- public vector_interface<T>
+ class vector_node exprtk_final
+ : public expression_node <T>
+ , public vector_interface<T>
{
public:
- typedef expression_node<T>* expression_ptr;
+ typedef expression_node<T>* expression_ptr;
typedef vector_holder<T> vector_holder_t;
typedef vector_node<T>* vector_node_ptr;
- typedef vec_data_store<T> vds_t;
+ typedef vec_data_store<T> vds_t;
explicit vector_node(vector_holder_t* vh)
- : vector_holder_(vh),
- vds_((*vector_holder_).size(),(*vector_holder_)[0])
+ : vector_holder_(vh)
+ , vds_((*vector_holder_).size(),(*vector_holder_)[0])
{
vector_holder_->set_ref(&vds_.ref());
}
vector_node(const vds_t& vds, vector_holder_t* vh)
- : vector_holder_(vh),
- vds_(vds)
+ : vector_holder_(vh)
+ , vds_(vds)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return vds().data()[0];
}
- vector_node_ptr vec() const
+ vector_node_ptr vec() const exprtk_override
{
return const_cast<vector_node_ptr>(this);
}
- vector_node_ptr vec()
+ vector_node_ptr vec() exprtk_override
{
return this;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vector;
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return vds().size();
}
- vds_t& vds()
+ vds_t& vds() exprtk_override
{
return vds_;
}
- const vds_t& vds() const
+ const vds_t& vds() const exprtk_override
{
return vds_;
}
@@ -7685,7 +7849,8 @@
};
template <typename T>
- class vector_elem_node : public expression_node<T>,
+ class vector_elem_node exprtk_final
+ : public expression_node<T>,
public ivariable <T>
{
public:
@@ -7696,28 +7861,28 @@
typedef std::pair<expression_ptr,bool> branch_t;
vector_elem_node(expression_ptr index, vector_holder_ptr vec_holder)
- : vec_holder_(vec_holder),
- vector_base_((*vec_holder)[0])
+ : vec_holder_(vec_holder)
+ , vector_base_((*vec_holder)[0])
{
construct_branch_pair(index_, index);
}
- inline T value() const
+ inline T value() const exprtk_override
{
return *(vector_base_ + static_cast<std::size_t>(details::numeric::to_int64(index_.first->value())));
}
- inline T& ref()
+ inline T& ref() exprtk_override
{
return *(vector_base_ + static_cast<std::size_t>(details::numeric::to_int64(index_.first->value())));
}
- inline const T& ref() const
+ inline const T& ref() const exprtk_override
{
return *(vector_base_ + static_cast<std::size_t>(details::numeric::to_int64(index_.first->value())));
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecelem;
}
@@ -7727,12 +7892,12 @@
return (*vec_holder_);
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(index_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(index_);
}
@@ -7745,7 +7910,8 @@
};
template <typename T>
- class rebasevector_elem_node : public expression_node<T>,
+ class rebasevector_elem_node exprtk_final
+ : public expression_node<T>,
public ivariable <T>
{
public:
@@ -7757,29 +7923,29 @@
typedef std::pair<expression_ptr,bool> branch_t;
rebasevector_elem_node(expression_ptr index, vector_holder_ptr vec_holder)
- : vector_holder_(vec_holder),
- vds_((*vector_holder_).size(),(*vector_holder_)[0])
+ : vector_holder_(vec_holder)
+ , vds_((*vector_holder_).size(),(*vector_holder_)[0])
{
vector_holder_->set_ref(&vds_.ref());
construct_branch_pair(index_, index);
}
- inline T value() const
+ inline T value() const exprtk_override
{
return *(vds_.data() + static_cast<std::size_t>(details::numeric::to_int64(index_.first->value())));
}
- inline T& ref()
+ inline T& ref() exprtk_override
{
return *(vds_.data() + static_cast<std::size_t>(details::numeric::to_int64(index_.first->value())));
}
- inline const T& ref() const
+ inline const T& ref() const exprtk_override
{
return *(vds_.data() + static_cast<std::size_t>(details::numeric::to_int64(index_.first->value())));
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_rbvecelem;
}
@@ -7789,12 +7955,12 @@
return (*vector_holder_);
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::template collect(index_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(index_);
}
@@ -7807,7 +7973,8 @@
};
template <typename T>
- class rebasevector_celem_node : public expression_node<T>,
+ class rebasevector_celem_node exprtk_final
+ : public expression_node<T>,
public ivariable <T>
{
public:
@@ -7818,29 +7985,29 @@
typedef vec_data_store<T> vds_t;
rebasevector_celem_node(const std::size_t index, vector_holder_ptr vec_holder)
- : index_(index),
- vector_holder_(vec_holder),
- vds_((*vector_holder_).size(),(*vector_holder_)[0])
+ : index_(index)
+ , vector_holder_(vec_holder)
+ , vds_((*vector_holder_).size(),(*vector_holder_)[0])
{
vector_holder_->set_ref(&vds_.ref());
}
- inline T value() const
+ inline T value() const exprtk_override
{
return *(vds_.data() + index_);
}
- inline T& ref()
+ inline T& ref() exprtk_override
{
return *(vds_.data() + index_);
}
- inline const T& ref() const
+ inline const T& ref() const exprtk_override
{
return *(vds_.data() + index_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_rbveccelem;
}
@@ -7858,7 +8025,7 @@
};
template <typename T>
- class vector_assignment_node : public expression_node<T>
+ class vector_assignment_node exprtk_final : public expression_node<T>
{
public:
@@ -7868,13 +8035,13 @@
const std::size_t& size,
const std::vector<expression_ptr>& initialiser_list,
const bool single_value_initialse)
- : vector_base_(vector_base),
- initialiser_list_(initialiser_list),
- size_(size),
- single_value_initialse_(single_value_initialse)
+ : vector_base_(vector_base)
+ , initialiser_list_(initialiser_list)
+ , size_(size)
+ , single_value_initialse_(single_value_initialse)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
if (single_value_initialse_)
{
@@ -7885,16 +8052,16 @@
}
else
{
- std::size_t il_size = initialiser_list_.size();
+ const std::size_t initialiser_list_size = initialiser_list_.size();
- for (std::size_t i = 0; i < il_size; ++i)
+ for (std::size_t i = 0; i < initialiser_list_size; ++i)
{
*(vector_base_ + i) = initialiser_list_[i]->value();
}
- if (il_size < size_)
+ if (initialiser_list_size < size_)
{
- for (std::size_t i = il_size; i < size_; ++i)
+ for (std::size_t i = initialiser_list_size; i < size_; ++i)
{
*(vector_base_ + i) = T(0);
}
@@ -7904,24 +8071,25 @@
return *(vector_base_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecdefass;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(initialiser_list_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(initialiser_list_);
}
private:
- vector_assignment_node<T>& operator=(const vector_assignment_node<T>&);
+ vector_assignment_node(const vector_assignment_node<T>&) exprtk_delete;
+ vector_assignment_node<T>& operator=(const vector_assignment_node<T>&) exprtk_delete;
mutable T* vector_base_;
std::vector<expression_ptr> initialiser_list_;
@@ -7930,7 +8098,7 @@
};
template <typename T>
- class swap_node : public expression_node<T>
+ class swap_node exprtk_final : public expression_node<T>
{
public:
@@ -7938,17 +8106,17 @@
typedef variable_node<T>* variable_node_ptr;
swap_node(variable_node_ptr var0, variable_node_ptr var1)
- : var0_(var0),
- var1_(var1)
+ : var0_(var0)
+ , var1_(var1)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
std::swap(var0_->ref(),var1_->ref());
return var1_->ref();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_swap;
}
@@ -7960,26 +8128,26 @@
};
template <typename T>
- class swap_generic_node : public binary_node<T>
+ class swap_generic_node exprtk_final : public binary_node<T>
{
public:
typedef expression_node<T>* expression_ptr;
- typedef ivariable<T>* ivariable_ptr;
+ typedef ivariable<T>* ivariable_ptr;
swap_generic_node(expression_ptr var0, expression_ptr var1)
- : binary_node<T>(details::e_swap, var0, var1),
- var0_(dynamic_cast<ivariable_ptr>(var0)),
- var1_(dynamic_cast<ivariable_ptr>(var1))
+ : binary_node<T>(details::e_swap, var0, var1)
+ , var0_(dynamic_cast<ivariable_ptr>(var0))
+ , var1_(dynamic_cast<ivariable_ptr>(var1))
{}
- inline T value() const
+ inline T value() const exprtk_override
{
std::swap(var0_->ref(),var1_->ref());
return var1_->ref();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_swap;
}
@@ -7991,22 +8159,23 @@
};
template <typename T>
- class swap_vecvec_node : public binary_node <T>,
- public vector_interface<T>
+ class swap_vecvec_node exprtk_final
+ : public binary_node <T>
+ , public vector_interface<T>
{
public:
- typedef expression_node<T>* expression_ptr;
- typedef vector_node<T>* vector_node_ptr;
- typedef vec_data_store<T> vds_t;
+ typedef expression_node<T>* expression_ptr;
+ typedef vector_node <T>* vector_node_ptr;
+ typedef vec_data_store <T> vds_t;
swap_vecvec_node(expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(details::e_swap, branch0, branch1),
- vec0_node_ptr_(0),
- vec1_node_ptr_(0),
- vec_size_ (0),
- initialised_ (false)
+ : binary_node<T>(details::e_swap, branch0, branch1)
+ , vec0_node_ptr_(0)
+ , vec1_node_ptr_(0)
+ , vec_size_ (0)
+ , initialised_ (false)
{
if (is_ivector_node(binary_node<T>::branch_[0].first))
{
@@ -8036,15 +8205,17 @@
initialised_ = true;
}
+
+ assert(initialised_);
}
- inline T value() const
+ inline T value() const exprtk_override
{
- assert(binary_node<T>::branch_[0].first);
- assert(binary_node<T>::branch_[1].first);
-
if (initialised_)
{
+ assert(binary_node<T>::branch_[0].first);
+ assert(binary_node<T>::branch_[1].first);
+
binary_node<T>::branch_[0].first->value();
binary_node<T>::branch_[1].first->value();
@@ -8062,32 +8233,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- vector_node_ptr vec() const
+ vector_node_ptr vec() const exprtk_override
{
return vec0_node_ptr_;
}
- vector_node_ptr vec()
+ vector_node_ptr vec() exprtk_override
{
return vec0_node_ptr_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecvecswap;
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return vec_size_;
}
- vds_t& vds()
+ vds_t& vds() exprtk_override
{
return vds_;
}
- const vds_t& vds() const
+ const vds_t& vds() const exprtk_override
{
return vds_;
}
@@ -8103,13 +8274,14 @@
#ifndef exprtk_disable_string_capabilities
template <typename T>
- class stringvar_node : public expression_node <T>,
+ class stringvar_node exprtk_final
+ : public expression_node <T>,
public string_base_node<T>,
public range_interface <T>
{
public:
- typedef range_pack<T> range_t;
+ typedef typename range_interface<T>::range_t range_t;
static std::string null_value;
@@ -8131,7 +8303,7 @@
return this < (&v);
}
- inline T value() const
+ inline T value() const exprtk_override
{
rp_.n1_c.second = (*value_).size() - 1;
rp_.cache.second = rp_.n1_c.second;
@@ -8139,17 +8311,17 @@
return std::numeric_limits<T>::quiet_NaN();
}
- std::string str() const
+ std::string str() const exprtk_override
{
return ref();
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return &(*value_)[0];
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return ref().size();
}
@@ -8164,21 +8336,30 @@
return (*value_);
}
- range_t& range_ref()
+ range_t& range_ref() exprtk_override
{
return rp_;
}
- const range_t& range_ref() const
+ const range_t& range_ref() const exprtk_override
{
return rp_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_stringvar;
}
+ void rebase(std::string& s)
+ {
+ value_ = &s;
+ rp_.n0_c = std::make_pair<bool,std::size_t>(true,0);
+ rp_.n1_c = std::make_pair<bool,std::size_t>(true,value_->size() - 1);
+ rp_.cache.first = rp_.n0_c.second;
+ rp_.cache.second = rp_.n1_c.second;
+ }
+
private:
std::string* value_;
@@ -8189,19 +8370,20 @@
std::string stringvar_node<T>::null_value = std::string("");
template <typename T>
- class string_range_node : public expression_node <T>,
+ class string_range_node exprtk_final
+ : public expression_node <T>,
public string_base_node<T>,
public range_interface <T>
{
public:
- typedef range_pack<T> range_t;
+ typedef typename range_interface<T>::range_t range_t;
static std::string null_value;
explicit string_range_node(std::string& v, const range_t& rp)
- : value_(&v),
- rp_(rp)
+ : value_(&v)
+ , rp_(rp)
{}
virtual ~string_range_node()
@@ -8214,22 +8396,22 @@
return this < (&v);
}
- inline T value() const
+ inline T value() const exprtk_override
{
return std::numeric_limits<T>::quiet_NaN();
}
- inline std::string str() const
+ inline std::string str() const exprtk_override
{
return (*value_);
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return &(*value_)[0];
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return ref().size();
}
@@ -8249,17 +8431,17 @@
return (*value_);
}
- inline range_t& range_ref()
+ inline range_t& range_ref() exprtk_override
{
return rp_;
}
- inline const range_t& range_ref() const
+ inline const range_t& range_ref() const exprtk_override
{
return rp_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_stringvarrng;
}
@@ -8274,17 +8456,18 @@
std::string string_range_node<T>::null_value = std::string("");
template <typename T>
- class const_string_range_node : public expression_node <T>,
+ class const_string_range_node exprtk_final
+ : public expression_node <T>,
public string_base_node<T>,
public range_interface <T>
{
public:
- typedef range_pack<T> range_t;
+ typedef typename range_interface<T>::range_t range_t;
explicit const_string_range_node(const std::string& v, const range_t& rp)
- : value_(v),
- rp_(rp)
+ : value_(v)
+ , rp_(rp)
{}
~const_string_range_node()
@@ -8292,22 +8475,22 @@
rp_.free();
}
- inline T value() const
+ inline T value() const exprtk_override
{
return std::numeric_limits<T>::quiet_NaN();
}
- std::string str() const
+ std::string str() const exprtk_override
{
return value_;
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return value_.data();
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return value_.size();
}
@@ -8317,51 +8500,52 @@
return rp_;
}
- range_t& range_ref()
+ range_t& range_ref() exprtk_override
{
return rp_;
}
- const range_t& range_ref() const
+ const range_t& range_ref() const exprtk_override
{
return rp_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_cstringvarrng;
}
private:
- const_string_range_node<T>& operator=(const const_string_range_node<T>&);
+ const_string_range_node(const const_string_range_node<T>&) exprtk_delete;
+ const_string_range_node<T>& operator=(const const_string_range_node<T>&) exprtk_delete;
const std::string value_;
range_t rp_;
};
template <typename T>
- class generic_string_range_node : public expression_node <T>,
+ class generic_string_range_node exprtk_final
+ : public expression_node <T>,
public string_base_node<T>,
public range_interface <T>
{
public:
- typedef expression_node <T>* expression_ptr;
- typedef stringvar_node <T>* strvar_node_ptr;
- typedef string_base_node<T>* str_base_ptr;
- typedef range_pack <T> range_t;
- typedef range_t* range_ptr;
- typedef range_interface<T> irange_t;
- typedef irange_t* irange_ptr;
+ typedef expression_node <T>* expression_ptr;
+ typedef stringvar_node <T>* strvar_node_ptr;
+ typedef string_base_node<T>* str_base_ptr;
+ typedef typename range_interface<T>::range_t range_t;
+ typedef range_t* range_ptr;
+ typedef range_interface<T> irange_t;
+ typedef irange_t* irange_ptr;
typedef std::pair<expression_ptr,bool> branch_t;
-
generic_string_range_node(expression_ptr str_branch, const range_t& brange)
- : initialised_(false),
- str_base_ptr_ (0),
- str_range_ptr_(0),
- base_range_(brange)
+ : initialised_(false)
+ , str_base_ptr_ (0)
+ , str_range_ptr_(0)
+ , base_range_(brange)
{
range_.n0_c = std::make_pair<bool,std::size_t>(true,0);
range_.n1_c = std::make_pair<bool,std::size_t>(true,0);
@@ -8384,6 +8568,8 @@
}
initialised_ = (str_base_ptr_ && str_range_ptr_);
+
+ assert(initialised_);
}
~generic_string_range_node()
@@ -8391,7 +8577,7 @@
base_range_.free();
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (initialised_)
{
@@ -8411,7 +8597,7 @@
if (
range (str_r0, str_r1, base_str_size) &&
- base_range_( r0, r1, base_str_size)
+ base_range_( r0, r1, base_str_size - str_r0)
)
{
const std::size_t size = (r1 - r0) + 1;
@@ -8426,42 +8612,42 @@
return std::numeric_limits<T>::quiet_NaN();
}
- std::string str() const
+ std::string str() const exprtk_override
{
return value_;
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return &value_[0];
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return value_.size();
}
- range_t& range_ref()
+ range_t& range_ref() exprtk_override
{
return range_;
}
- const range_t& range_ref() const
+ const range_t& range_ref() const exprtk_override
{
return range_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_strgenrange;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
@@ -8469,37 +8655,38 @@
private:
bool initialised_;
- branch_t branch_;
- str_base_ptr str_base_ptr_;
- irange_ptr str_range_ptr_;
- mutable range_t base_range_;
- mutable range_t range_;
- mutable std::string value_;
+ branch_t branch_;
+ str_base_ptr str_base_ptr_;
+ irange_ptr str_range_ptr_;
+ mutable range_t base_range_;
+ mutable range_t range_;
+ mutable std::string value_;
};
template <typename T>
- class string_concat_node : public binary_node <T>,
+ class string_concat_node exprtk_final
+ : public binary_node <T>,
public string_base_node<T>,
public range_interface <T>
{
public:
- typedef expression_node <T>* expression_ptr;
- typedef string_base_node<T>* str_base_ptr;
- typedef range_pack <T> range_t;
- typedef range_t* range_ptr;
- typedef range_interface<T> irange_t;
- typedef irange_t* irange_ptr;
+ typedef typename range_interface<T>::range_t range_t;
+ typedef range_interface<T> irange_t;
+ typedef irange_t* irange_ptr;
+ typedef range_t* range_ptr;
+ typedef expression_node <T>* expression_ptr;
+ typedef string_base_node<T>* str_base_ptr;
string_concat_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- initialised_(false),
- str0_base_ptr_ (0),
- str1_base_ptr_ (0),
- str0_range_ptr_(0),
- str1_range_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , initialised_(false)
+ , str0_base_ptr_ (0)
+ , str1_base_ptr_ (0)
+ , str0_range_ptr_(0)
+ , str1_range_ptr_(0)
{
range_.n0_c = std::make_pair<bool,std::size_t>(true,0);
range_.n1_c = std::make_pair<bool,std::size_t>(true,0);
@@ -8537,9 +8724,11 @@
str1_base_ptr_ &&
str0_range_ptr_ &&
str1_range_ptr_ ;
+
+ assert(initialised_);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (initialised_)
{
@@ -8577,61 +8766,62 @@
return std::numeric_limits<T>::quiet_NaN();
}
- std::string str() const
+ std::string str() const exprtk_override
{
return value_;
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return &value_[0];
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return value_.size();
}
- range_t& range_ref()
+ range_t& range_ref() exprtk_override
{
return range_;
}
- const range_t& range_ref() const
+ const range_t& range_ref() const exprtk_override
{
return range_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_strconcat;
}
private:
- bool initialised_;
- str_base_ptr str0_base_ptr_;
- str_base_ptr str1_base_ptr_;
- irange_ptr str0_range_ptr_;
- irange_ptr str1_range_ptr_;
+ bool initialised_;
+ str_base_ptr str0_base_ptr_;
+ str_base_ptr str1_base_ptr_;
+ irange_ptr str0_range_ptr_;
+ irange_ptr str1_range_ptr_;
mutable range_t range_;
mutable std::string value_;
};
template <typename T>
- class swap_string_node : public binary_node <T>,
+ class swap_string_node exprtk_final
+ : public binary_node <T>,
public string_base_node<T>,
public range_interface <T>
{
public:
- typedef expression_node <T>* expression_ptr;
+ typedef typename range_interface<T>::range_t range_t;
+ typedef range_t* range_ptr;
+ typedef range_interface<T> irange_t;
+ typedef irange_t* irange_ptr;
+ typedef expression_node <T>* expression_ptr;
typedef stringvar_node <T>* strvar_node_ptr;
- typedef string_base_node<T>* str_base_ptr;
- typedef range_pack <T> range_t;
- typedef range_t* range_ptr;
- typedef range_interface<T> irange_t;
- typedef irange_t* irange_ptr;
+ typedef string_base_node<T>* str_base_ptr;
swap_string_node(expression_ptr branch0, expression_ptr branch1)
: binary_node<T>(details::e_swap, branch0, branch1),
@@ -8650,9 +8840,11 @@
}
initialised_ = (str0_node_ptr_ && str1_node_ptr_);
+
+ assert(initialised_);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (initialised_)
{
@@ -8668,32 +8860,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- std::string str() const
+ std::string str() const exprtk_override
{
return str0_node_ptr_->str();
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return str0_node_ptr_->base();
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return str0_node_ptr_->size();
}
- range_t& range_ref()
+ range_t& range_ref() exprtk_override
{
return str0_node_ptr_->range_ref();
}
- const range_t& range_ref() const
+ const range_t& range_ref() const exprtk_override
{
return str0_node_ptr_->range_ref();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_strswap;
}
@@ -8706,25 +8898,25 @@
};
template <typename T>
- class swap_genstrings_node : public binary_node<T>
+ class swap_genstrings_node exprtk_final : public binary_node<T>
{
public:
+ typedef typename range_interface<T>::range_t range_t;
+ typedef range_t* range_ptr;
+ typedef range_interface<T> irange_t;
+ typedef irange_t* irange_ptr;
typedef expression_node <T>* expression_ptr;
- typedef string_base_node<T>* str_base_ptr;
- typedef range_pack <T> range_t;
- typedef range_t* range_ptr;
- typedef range_interface<T> irange_t;
- typedef irange_t* irange_ptr;
+ typedef string_base_node<T>* str_base_ptr;
swap_genstrings_node(expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(details::e_default, branch0, branch1),
- str0_base_ptr_ (0),
- str1_base_ptr_ (0),
- str0_range_ptr_(0),
- str1_range_ptr_(0),
- initialised_(false)
+ : binary_node<T>(details::e_default, branch0, branch1)
+ , str0_base_ptr_ (0)
+ , str1_base_ptr_ (0)
+ , str0_range_ptr_(0)
+ , str1_range_ptr_(0)
+ , initialised_(false)
{
if (is_generally_string_node(binary_node<T>::branch_[0].first))
{
@@ -8760,9 +8952,11 @@
str1_base_ptr_ &&
str0_range_ptr_ &&
str1_range_ptr_ ;
+
+ assert(initialised_);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (initialised_)
{
@@ -8845,15 +9039,15 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_strswap;
}
private:
- swap_genstrings_node(swap_genstrings_node<T>&);
- swap_genstrings_node<T>& operator=(swap_genstrings_node<T>&);
+ swap_genstrings_node(const swap_genstrings_node<T>&) exprtk_delete;
+ swap_genstrings_node<T>& operator=(const swap_genstrings_node<T>&) exprtk_delete;
str_base_ptr str0_base_ptr_;
str_base_ptr str1_base_ptr_;
@@ -8863,7 +9057,7 @@
};
template <typename T>
- class stringvar_size_node : public expression_node<T>
+ class stringvar_size_node exprtk_final : public expression_node<T>
{
public:
@@ -8877,12 +9071,12 @@
: value_(&v)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return T((*value_).size());
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_stringvarsize;
}
@@ -8896,15 +9090,14 @@
std::string stringvar_size_node<T>::null_value = std::string("");
template <typename T>
- class string_size_node : public expression_node<T>
+ class string_size_node exprtk_final : public expression_node<T>
{
public:
- typedef expression_node <T>* expression_ptr;
- typedef string_base_node<T>* str_base_ptr;
+ typedef expression_node <T>* expression_ptr;
+ typedef string_base_node<T>* str_base_ptr;
typedef std::pair<expression_ptr,bool> branch_t;
-
explicit string_size_node(expression_ptr branch)
: str_base_ptr_(0)
{
@@ -8919,7 +9112,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
T result = std::numeric_limits<T>::quiet_NaN();
@@ -8932,17 +9125,17 @@
return result;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_stringsize;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
@@ -8966,29 +9159,30 @@
};
template <typename T, typename AssignmentProcess = asn_assignment>
- class assignment_string_node : public binary_node <T>,
+ class assignment_string_node exprtk_final
+ : public binary_node <T>,
public string_base_node<T>,
public range_interface <T>
{
public:
- typedef expression_node <T>* expression_ptr;
+ typedef typename range_interface<T>::range_t range_t;
+ typedef range_t* range_ptr;
+ typedef range_interface <T> irange_t;
+ typedef irange_t* irange_ptr;
+ typedef expression_node <T>* expression_ptr;
typedef stringvar_node <T>* strvar_node_ptr;
- typedef string_base_node<T>* str_base_ptr;
- typedef range_pack <T> range_t;
- typedef range_t* range_ptr;
- typedef range_interface<T> irange_t;
- typedef irange_t* irange_ptr;
+ typedef string_base_node<T>* str_base_ptr;
assignment_string_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- initialised_(false),
- str0_base_ptr_ (0),
- str1_base_ptr_ (0),
- str0_node_ptr_ (0),
- str1_range_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , initialised_(false)
+ , str0_base_ptr_ (0)
+ , str1_base_ptr_ (0)
+ , str0_node_ptr_ (0)
+ , str1_range_ptr_(0)
{
if (is_string_node(binary_node<T>::branch_[0].first))
{
@@ -9016,9 +9210,11 @@
str1_base_ptr_ &&
str0_node_ptr_ &&
str1_range_ptr_ ;
+
+ assert(initialised_);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (initialised_)
{
@@ -9045,32 +9241,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- std::string str() const
+ std::string str() const exprtk_override
{
return str0_node_ptr_->str();
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return str0_node_ptr_->base();
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return str0_node_ptr_->size();
}
- range_t& range_ref()
+ range_t& range_ref() exprtk_override
{
return str0_node_ptr_->range_ref();
}
- const range_t& range_ref() const
+ const range_t& range_ref() const exprtk_override
{
return str0_node_ptr_->range_ref();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_strass;
}
@@ -9085,31 +9281,32 @@
};
template <typename T, typename AssignmentProcess = asn_assignment>
- class assignment_string_range_node : public binary_node <T>,
+ class assignment_string_range_node exprtk_final
+ : public binary_node <T>,
public string_base_node<T>,
public range_interface <T>
{
public:
- typedef expression_node <T>* expression_ptr;
- typedef stringvar_node <T>* strvar_node_ptr;
+ typedef typename range_interface<T>::range_t range_t;
+ typedef range_t* range_ptr;
+ typedef range_interface <T> irange_t;
+ typedef irange_t* irange_ptr;
+ typedef expression_node <T>* expression_ptr;
+ typedef stringvar_node <T>* strvar_node_ptr;
typedef string_range_node<T>* str_rng_node_ptr;
- typedef string_base_node <T>* str_base_ptr;
- typedef range_pack <T> range_t;
- typedef range_t* range_ptr;
- typedef range_interface<T> irange_t;
- typedef irange_t* irange_ptr;
+ typedef string_base_node <T>* str_base_ptr;
assignment_string_range_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- initialised_(false),
- str0_base_ptr_ (0),
- str1_base_ptr_ (0),
- str0_rng_node_ptr_ (0),
- str0_range_ptr_ (0),
- str1_range_ptr_ (0)
+ : binary_node<T>(opr, branch0, branch1)
+ , initialised_(false)
+ , str0_base_ptr_ (0)
+ , str1_base_ptr_ (0)
+ , str0_rng_node_ptr_(0)
+ , str0_range_ptr_ (0)
+ , str1_range_ptr_ (0)
{
if (is_string_range_node(binary_node<T>::branch_[0].first))
{
@@ -9145,9 +9342,11 @@
str0_rng_node_ptr_ &&
str0_range_ptr_ &&
str1_range_ptr_ ;
+
+ assert(initialised_);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (initialised_)
{
@@ -9182,32 +9381,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- std::string str() const
+ std::string str() const exprtk_override
{
return str0_base_ptr_->str();
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return str0_base_ptr_->base();
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return str0_base_ptr_->size();
}
- range_t& range_ref()
+ range_t& range_ref() exprtk_override
{
return str0_rng_node_ptr_->range_ref();
}
- const range_t& range_ref() const
+ const range_t& range_ref() const exprtk_override
{
return str0_rng_node_ptr_->range_ref();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_strass;
}
@@ -9223,31 +9422,32 @@
};
template <typename T>
- class conditional_string_node : public trinary_node <T>,
+ class conditional_string_node exprtk_final
+ : public trinary_node <T>,
public string_base_node<T>,
public range_interface <T>
{
public:
+ typedef typename range_interface<T>::range_t range_t;
+ typedef range_t* range_ptr;
+ typedef range_interface <T> irange_t;
+ typedef irange_t* irange_ptr;
typedef expression_node <T>* expression_ptr;
- typedef string_base_node<T>* str_base_ptr;
- typedef range_pack <T> range_t;
- typedef range_t* range_ptr;
- typedef range_interface<T> irange_t;
- typedef irange_t* irange_ptr;
+ typedef string_base_node<T>* str_base_ptr;
conditional_string_node(expression_ptr condition,
expression_ptr consequent,
expression_ptr alternative)
- : trinary_node<T>(details::e_default,consequent,alternative,condition),
- initialised_(false),
- str0_base_ptr_ (0),
- str1_base_ptr_ (0),
- str0_range_ptr_(0),
- str1_range_ptr_(0),
- condition_ (condition),
- consequent_ (consequent),
- alternative_(alternative)
+ : trinary_node<T>(details::e_default, consequent, alternative, condition)
+ , initialised_(false)
+ , str0_base_ptr_ (0)
+ , str1_base_ptr_ (0)
+ , str0_range_ptr_(0)
+ , str1_range_ptr_(0)
+ , condition_ (condition )
+ , consequent_ (consequent )
+ , alternative_(alternative)
{
range_.n0_c = std::make_pair<bool,std::size_t>(true,0);
range_.n1_c = std::make_pair<bool,std::size_t>(true,0);
@@ -9286,9 +9486,10 @@
str0_range_ptr_ &&
str1_range_ptr_ ;
+ assert(initialised_);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (initialised_)
{
@@ -9340,32 +9541,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- std::string str() const
+ std::string str() const exprtk_override
{
return value_;
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return &value_[0];
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return value_.size();
}
- range_t& range_ref()
+ range_t& range_ref() exprtk_override
{
return range_;
}
- const range_t& range_ref() const
+ const range_t& range_ref() const exprtk_override
{
return range_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_strcondition;
}
@@ -9386,27 +9587,28 @@
};
template <typename T>
- class cons_conditional_str_node : public binary_node <T>,
+ class cons_conditional_str_node exprtk_final
+ : public binary_node <T>,
public string_base_node<T>,
public range_interface <T>
{
public:
+ typedef typename range_interface<T>::range_t range_t;
+ typedef range_t* range_ptr;
+ typedef range_interface <T> irange_t;
+ typedef irange_t* irange_ptr;
typedef expression_node <T>* expression_ptr;
- typedef string_base_node<T>* str_base_ptr;
- typedef range_pack <T> range_t;
- typedef range_t* range_ptr;
- typedef range_interface<T> irange_t;
- typedef irange_t* irange_ptr;
+ typedef string_base_node<T>* str_base_ptr;
cons_conditional_str_node(expression_ptr condition,
expression_ptr consequent)
- : binary_node<T>(details::e_default, consequent, condition),
- initialised_(false),
- str0_base_ptr_ (0),
- str0_range_ptr_(0),
- condition_ (condition),
- consequent_(consequent)
+ : binary_node<T>(details::e_default, consequent, condition)
+ , initialised_(false)
+ , str0_base_ptr_ (0)
+ , str0_range_ptr_(0)
+ , condition_ (condition )
+ , consequent_(consequent)
{
range_.n0_c = std::make_pair<bool,std::size_t>(true,0);
range_.n1_c = std::make_pair<bool,std::size_t>(true,0);
@@ -9428,9 +9630,11 @@
}
initialised_ = str0_base_ptr_ && str0_range_ptr_ ;
+
+ assert(initialised_);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (initialised_)
{
@@ -9488,7 +9692,7 @@
return range_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_strccondition;
}
@@ -9506,26 +9710,27 @@
};
template <typename T, typename VarArgFunction>
- class str_vararg_node : public expression_node <T>,
- public string_base_node<T>,
- public range_interface <T>
+ class str_vararg_node exprtk_final
+ : public expression_node <T>,
+ public string_base_node<T>,
+ public range_interface <T>
{
public:
- typedef expression_node <T>* expression_ptr;
- typedef string_base_node<T>* str_base_ptr;
- typedef range_pack <T> range_t;
- typedef range_t* range_ptr;
- typedef range_interface<T> irange_t;
- typedef irange_t* irange_ptr;
+ typedef typename range_interface<T>::range_t range_t;
+ typedef range_t* range_ptr;
+ typedef range_interface <T> irange_t;
+ typedef irange_t* irange_ptr;
+ typedef expression_node <T>* expression_ptr;
+ typedef string_base_node<T>* str_base_ptr;
typedef std::pair<expression_ptr,bool> branch_t;
template <typename Allocator,
template <typename, typename> class Sequence>
explicit str_vararg_node(const Sequence<expression_ptr,Allocator>& arg_list)
- : initialised_(false),
- str_base_ptr_ (0),
- str_range_ptr_(0)
+ : initialised_(false)
+ , str_base_ptr_ (0)
+ , str_range_ptr_(0)
{
construct_branch_pair(final_node_, const_cast<expression_ptr>(arg_list.back()));
@@ -9567,7 +9772,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (!arg_list_.empty())
{
@@ -9579,43 +9784,43 @@
return std::numeric_limits<T>::quiet_NaN();
}
- std::string str() const
+ std::string str() const exprtk_override
{
return str_base_ptr_->str();
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return str_base_ptr_->base();
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return str_base_ptr_->size();
}
- range_t& range_ref()
+ range_t& range_ref() exprtk_override
{
return str_range_ptr_->range_ref();
}
- const range_t& range_ref() const
+ const range_t& range_ref() const exprtk_override
{
return str_range_ptr_->range_ref();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_stringvararg;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
- expression_node<T>::ndb_t::collect(final_node_, node_delete_list);
- expression_node<T>::ndb_t::collect(arg_list_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(final_node_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(arg_list_ , node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return std::max(
expression_node<T>::ndb_t::compute_node_depth(final_node_),
@@ -9633,14 +9838,14 @@
#endif
template <typename T, std::size_t N>
- inline T axn(T a, T x)
+ inline T axn(const T a, const T x)
{
// a*x^n
return a * exprtk::details::numeric::fast_exp<T,N>::result(x);
}
template <typename T, std::size_t N>
- inline T axnb(T a, T x, T b)
+ inline T axnb(const T a, const T x, const T b)
{
// a*x^n+b
return a * exprtk::details::numeric::fast_exp<T,N>::result(x) + b;
@@ -9652,12 +9857,12 @@
typedef typename details::functor_t<T>::Type Type;
typedef typename details::functor_t<T> functor_t;
typedef typename functor_t::qfunc_t quaternary_functor_t;
- typedef typename functor_t::tfunc_t trinary_functor_t;
- typedef typename functor_t::bfunc_t binary_functor_t;
- typedef typename functor_t::ufunc_t unary_functor_t;
+ typedef typename functor_t::tfunc_t trinary_functor_t;
+ typedef typename functor_t::bfunc_t binary_functor_t;
+ typedef typename functor_t::ufunc_t unary_functor_t;
};
- #define define_sfop3(NN,OP0,OP1) \
+ #define define_sfop3(NN, OP0, OP1) \
template <typename T> \
struct sf##NN##_op : public sf_base<T> \
{ \
@@ -9721,7 +9926,7 @@
define_sfop3(46,x * numeric::cos(y) - z ,"")
define_sfop3(47,details::is_true(x) ? y : z,"")
- #define define_sfop4(NN,OP0,OP1) \
+ #define define_sfop4(NN, OP0, OP1) \
template <typename T> \
struct sf##NN##_op : public sf_base<T> \
{ \
@@ -9857,7 +10062,7 @@
#undef define_sfop4
template <typename T, typename SpecialFunction>
- class sf3_node : public trinary_node<T>
+ class sf3_node exprtk_final : public trinary_node<T>
{
public:
@@ -9870,7 +10075,7 @@
: trinary_node<T>(opr, branch0, branch1, branch2)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(trinary_node<T>::branch_[0].first);
assert(trinary_node<T>::branch_[1].first);
@@ -9885,7 +10090,7 @@
};
template <typename T, typename SpecialFunction>
- class sf4_node : public quaternary_node<T>
+ class sf4_node exprtk_final : public quaternary_node<T>
{
public:
@@ -9899,7 +10104,7 @@
: quaternary_node<T>(opr, branch0, branch1, branch2, branch3)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(quaternary_node<T>::branch_[0].first);
assert(quaternary_node<T>::branch_[1].first);
@@ -9916,32 +10121,32 @@
};
template <typename T, typename SpecialFunction>
- class sf3_var_node : public expression_node<T>
+ class sf3_var_node exprtk_final : public expression_node<T>
{
public:
typedef expression_node<T>* expression_ptr;
sf3_var_node(const T& v0, const T& v1, const T& v2)
- : v0_(v0),
- v1_(v1),
- v2_(v2)
+ : v0_(v0)
+ , v1_(v1)
+ , v2_(v2)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return SpecialFunction::process(v0_, v1_, v2_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_trinary;
}
private:
- sf3_var_node(sf3_var_node<T,SpecialFunction>&);
- sf3_var_node<T,SpecialFunction>& operator=(sf3_var_node<T,SpecialFunction>&);
+ sf3_var_node(const sf3_var_node<T,SpecialFunction>&) exprtk_delete;
+ sf3_var_node<T,SpecialFunction>& operator=(const sf3_var_node<T,SpecialFunction>&) exprtk_delete;
const T& v0_;
const T& v1_;
@@ -9949,33 +10154,33 @@
};
template <typename T, typename SpecialFunction>
- class sf4_var_node : public expression_node<T>
+ class sf4_var_node exprtk_final : public expression_node<T>
{
public:
typedef expression_node<T>* expression_ptr;
sf4_var_node(const T& v0, const T& v1, const T& v2, const T& v3)
- : v0_(v0),
- v1_(v1),
- v2_(v2),
- v3_(v3)
+ : v0_(v0)
+ , v1_(v1)
+ , v2_(v2)
+ , v3_(v3)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return SpecialFunction::process(v0_, v1_, v2_, v3_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_trinary;
}
private:
- sf4_var_node(sf4_var_node<T,SpecialFunction>&);
- sf4_var_node<T,SpecialFunction>& operator=(sf4_var_node<T,SpecialFunction>&);
+ sf4_var_node(const sf4_var_node<T,SpecialFunction>&) exprtk_delete;
+ sf4_var_node<T,SpecialFunction>& operator=(const sf4_var_node<T,SpecialFunction>&) exprtk_delete;
const T& v0_;
const T& v1_;
@@ -9984,7 +10189,7 @@
};
template <typename T, typename VarArgFunction>
- class vararg_node : public expression_node<T>
+ class vararg_node exprtk_final : public expression_node<T>
{
public:
@@ -10011,22 +10216,22 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
return VarArgFunction::process(arg_list_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vararg;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(arg_list_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(arg_list_);
}
@@ -10037,7 +10242,7 @@
};
template <typename T, typename VarArgFunction>
- class vararg_varnode : public expression_node<T>
+ class vararg_varnode exprtk_final : public expression_node<T>
{
public:
@@ -10064,7 +10269,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (!arg_list_.empty())
return VarArgFunction::process(arg_list_);
@@ -10072,7 +10277,7 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vararg;
}
@@ -10083,7 +10288,7 @@
};
template <typename T, typename VecFunction>
- class vectorize_node : public expression_node<T>
+ class vectorize_node exprtk_final : public expression_node<T>
{
public:
@@ -10103,7 +10308,7 @@
ivec_ptr_ = 0;
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (ivec_ptr_)
{
@@ -10117,17 +10322,17 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecfunc;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(v_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(v_);
}
@@ -10139,7 +10344,7 @@
};
template <typename T>
- class assignment_node : public binary_node<T>
+ class assignment_node exprtk_final : public binary_node<T>
{
public:
@@ -10148,8 +10353,8 @@
assignment_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- var_node_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , var_node_ptr_(0)
{
if (is_variable_node(binary_node<T>::branch_[0].first))
{
@@ -10157,7 +10362,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (var_node_ptr_)
{
@@ -10179,7 +10384,7 @@
};
template <typename T>
- class assignment_vec_elem_node : public binary_node<T>
+ class assignment_vec_elem_node exprtk_final : public binary_node<T>
{
public:
@@ -10188,8 +10393,8 @@
assignment_vec_elem_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- vec_node_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , vec_node_ptr_(0)
{
if (is_vector_elem_node(binary_node<T>::branch_[0].first))
{
@@ -10197,7 +10402,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (vec_node_ptr_)
{
@@ -10219,7 +10424,7 @@
};
template <typename T>
- class assignment_rebasevec_elem_node : public binary_node<T>
+ class assignment_rebasevec_elem_node exprtk_final : public binary_node<T>
{
public:
@@ -10228,8 +10433,8 @@
assignment_rebasevec_elem_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- rbvec_node_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , rbvec_node_ptr_(0)
{
if (is_rebasevector_elem_node(binary_node<T>::branch_[0].first))
{
@@ -10237,7 +10442,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (rbvec_node_ptr_)
{
@@ -10259,7 +10464,7 @@
};
template <typename T>
- class assignment_rebasevec_celem_node : public binary_node<T>
+ class assignment_rebasevec_celem_node exprtk_final : public binary_node<T>
{
public:
@@ -10268,8 +10473,8 @@
assignment_rebasevec_celem_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- rbvec_node_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , rbvec_node_ptr_(0)
{
if (is_rebasevector_celem_node(binary_node<T>::branch_[0].first))
{
@@ -10277,7 +10482,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (rbvec_node_ptr_)
{
@@ -10299,20 +10504,21 @@
};
template <typename T>
- class assignment_vec_node : public binary_node <T>,
- public vector_interface<T>
+ class assignment_vec_node exprtk_final
+ : public binary_node <T>
+ , public vector_interface<T>
{
public:
typedef expression_node<T>* expression_ptr;
- typedef vector_node<T>* vector_node_ptr;
- typedef vec_data_store<T> vds_t;
+ typedef vector_node<T>* vector_node_ptr;
+ typedef vec_data_store<T> vds_t;
assignment_vec_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- vec_node_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , vec_node_ptr_(0)
{
if (is_vector_node(binary_node<T>::branch_[0].first))
{
@@ -10321,7 +10527,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (vec_node_ptr_)
{
@@ -10381,32 +10587,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- vector_node_ptr vec() const
+ vector_node_ptr vec() const exprtk_override
{
return vec_node_ptr_;
}
- vector_node_ptr vec()
+ vector_node_ptr vec() exprtk_override
{
return vec_node_ptr_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecvalass;
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return vds().size();
}
- vds_t& vds()
+ vds_t& vds() exprtk_override
{
return vds_;
}
- const vds_t& vds() const
+ const vds_t& vds() const exprtk_override
{
return vds_;
}
@@ -10418,23 +10624,24 @@
};
template <typename T>
- class assignment_vecvec_node : public binary_node <T>,
- public vector_interface<T>
+ class assignment_vecvec_node exprtk_final
+ : public binary_node <T>
+ , public vector_interface<T>
{
public:
- typedef expression_node<T>* expression_ptr;
+ typedef expression_node<T>* expression_ptr;
typedef vector_node<T>* vector_node_ptr;
- typedef vec_data_store<T> vds_t;
+ typedef vec_data_store<T> vds_t;
assignment_vecvec_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- vec0_node_ptr_(0),
- vec1_node_ptr_(0),
- initialised_(false),
- src_is_ivec_(false)
+ : binary_node<T>(opr, branch0, branch1)
+ , vec0_node_ptr_(0)
+ , vec1_node_ptr_(0)
+ , initialised_(false)
+ , src_is_ivec_(false)
{
if (is_vector_node(binary_node<T>::branch_[0].first))
{
@@ -10466,9 +10673,11 @@
}
initialised_ = (vec0_node_ptr_ && vec1_node_ptr_);
+
+ assert(initialised_);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (initialised_)
{
@@ -10533,32 +10742,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- vector_node_ptr vec() const
+ vector_node_ptr vec() exprtk_override
{
return vec0_node_ptr_;
}
- vector_node_ptr vec()
+ vector_node_ptr vec() const exprtk_override
{
return vec0_node_ptr_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecvecass;
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return vds().size();
}
- vds_t& vds()
+ vds_t& vds() exprtk_override
{
return vds_;
}
- const vds_t& vds() const
+ const vds_t& vds() const exprtk_override
{
return vds_;
}
@@ -10573,7 +10782,7 @@
};
template <typename T, typename Operation>
- class assignment_op_node : public binary_node<T>
+ class assignment_op_node exprtk_final : public binary_node<T>
{
public:
@@ -10582,8 +10791,8 @@
assignment_op_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- var_node_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , var_node_ptr_(0)
{
if (is_variable_node(binary_node<T>::branch_[0].first))
{
@@ -10591,7 +10800,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (var_node_ptr_)
{
@@ -10612,7 +10821,7 @@
};
template <typename T, typename Operation>
- class assignment_vec_elem_op_node : public binary_node<T>
+ class assignment_vec_elem_op_node exprtk_final : public binary_node<T>
{
public:
@@ -10621,8 +10830,8 @@
assignment_vec_elem_op_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- vec_node_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , vec_node_ptr_(0)
{
if (is_vector_elem_node(binary_node<T>::branch_[0].first))
{
@@ -10630,7 +10839,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (vec_node_ptr_)
{
@@ -10651,7 +10860,7 @@
};
template <typename T, typename Operation>
- class assignment_rebasevec_elem_op_node : public binary_node<T>
+ class assignment_rebasevec_elem_op_node exprtk_final : public binary_node<T>
{
public:
@@ -10660,8 +10869,8 @@
assignment_rebasevec_elem_op_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- rbvec_node_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , rbvec_node_ptr_(0)
{
if (is_rebasevector_elem_node(binary_node<T>::branch_[0].first))
{
@@ -10669,7 +10878,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (rbvec_node_ptr_)
{
@@ -10690,7 +10899,7 @@
};
template <typename T, typename Operation>
- class assignment_rebasevec_celem_op_node : public binary_node<T>
+ class assignment_rebasevec_celem_op_node exprtk_final : public binary_node<T>
{
public:
@@ -10699,8 +10908,8 @@
assignment_rebasevec_celem_op_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- rbvec_node_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , rbvec_node_ptr_(0)
{
if (is_rebasevector_celem_node(binary_node<T>::branch_[0].first))
{
@@ -10708,7 +10917,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (rbvec_node_ptr_)
{
@@ -10729,20 +10938,21 @@
};
template <typename T, typename Operation>
- class assignment_vec_op_node : public binary_node <T>,
- public vector_interface<T>
+ class assignment_vec_op_node exprtk_final
+ : public binary_node <T>
+ , public vector_interface<T>
{
public:
- typedef expression_node<T>* expression_ptr;
+ typedef expression_node<T>* expression_ptr;
typedef vector_node<T>* vector_node_ptr;
- typedef vec_data_store<T> vds_t;
+ typedef vec_data_store<T> vds_t;
assignment_vec_op_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- vec_node_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , vec_node_ptr_(0)
{
if (is_vector_node(binary_node<T>::branch_[0].first))
{
@@ -10751,7 +10961,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (vec_node_ptr_)
{
@@ -10802,7 +11012,6 @@
}
exprtk_disable_fallthrough_end
-
#undef exprtk_loop
#undef case_stmt
@@ -10812,37 +11021,37 @@
return std::numeric_limits<T>::quiet_NaN();
}
- vector_node_ptr vec() const
+ vector_node_ptr vec() const exprtk_override
{
return vec_node_ptr_;
}
- vector_node_ptr vec()
+ vector_node_ptr vec() exprtk_override
{
return vec_node_ptr_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecopvalass;
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return vds().size();
}
- vds_t& vds()
+ vds_t& vds() exprtk_override
{
return vds_;
}
- const vds_t& vds() const
+ const vds_t& vds() const exprtk_override
{
return vds_;
}
- bool side_effect() const
+ bool side_effect() const exprtk_override
{
return true;
}
@@ -10854,22 +11063,23 @@
};
template <typename T, typename Operation>
- class assignment_vecvec_op_node : public binary_node <T>,
- public vector_interface<T>
+ class assignment_vecvec_op_node exprtk_final
+ : public binary_node <T>
+ , public vector_interface<T>
{
public:
- typedef expression_node<T>* expression_ptr;
+ typedef expression_node<T>* expression_ptr;
typedef vector_node<T>* vector_node_ptr;
- typedef vec_data_store<T> vds_t;
+ typedef vec_data_store<T> vds_t;
assignment_vecvec_op_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- vec0_node_ptr_(0),
- vec1_node_ptr_(0),
- initialised_(false)
+ : binary_node<T>(opr, branch0, branch1)
+ , vec0_node_ptr_(0)
+ , vec1_node_ptr_(0)
+ , initialised_(false)
{
if (is_vector_node(binary_node<T>::branch_[0].first))
{
@@ -10896,9 +11106,11 @@
}
initialised_ = (vec0_node_ptr_ && vec1_node_ptr_);
+
+ assert(initialised_);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (initialised_)
{
@@ -10964,37 +11176,37 @@
return std::numeric_limits<T>::quiet_NaN();
}
- vector_node_ptr vec() const
+ vector_node_ptr vec() const exprtk_override
{
return vec0_node_ptr_;
}
- vector_node_ptr vec()
+ vector_node_ptr vec() exprtk_override
{
return vec0_node_ptr_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecopvecass;
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return vds().size();
}
- vds_t& vds()
+ vds_t& vds() exprtk_override
{
return vds_;
}
- const vds_t& vds() const
+ const vds_t& vds() const exprtk_override
{
return vds_;
}
- bool side_effect() const
+ bool side_effect() const exprtk_override
{
return true;
}
@@ -11008,25 +11220,26 @@
};
template <typename T, typename Operation>
- class vec_binop_vecvec_node : public binary_node <T>,
- public vector_interface<T>
+ class vec_binop_vecvec_node exprtk_final
+ : public binary_node <T>
+ , public vector_interface<T>
{
public:
- typedef expression_node<T>* expression_ptr;
- typedef vector_node<T>* vector_node_ptr;
+ typedef expression_node<T>* expression_ptr;
+ typedef vector_node<T>* vector_node_ptr;
typedef vector_holder<T>* vector_holder_ptr;
- typedef vec_data_store<T> vds_t;
+ typedef vec_data_store<T> vds_t;
vec_binop_vecvec_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- vec0_node_ptr_(0),
- vec1_node_ptr_(0),
- temp_ (0),
- temp_vec_node_(0),
- initialised_(false)
+ : binary_node<T>(opr, branch0, branch1)
+ , vec0_node_ptr_(0)
+ , vec1_node_ptr_(0)
+ , temp_ (0)
+ , temp_vec_node_(0)
+ , initialised_(false)
{
bool v0_is_ivec = false;
bool v1_is_ivec = false;
@@ -11074,10 +11287,12 @@
vds_ = vds_t(std::min(vec0.size(),vec1.size()));
temp_ = new vector_holder<T>(vds().data(),vds().size());
- temp_vec_node_ = new vector_node<T> (vds(),temp_);
+ temp_vec_node_ = new vector_node <T>(vds(),temp_);
initialised_ = true;
}
+
+ assert(initialised_);
}
~vec_binop_vecvec_node()
@@ -11086,7 +11301,7 @@
delete temp_vec_node_;
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (initialised_)
{
@@ -11154,32 +11369,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- vector_node_ptr vec() const
+ vector_node_ptr vec() const exprtk_override
{
return temp_vec_node_;
}
- vector_node_ptr vec()
+ vector_node_ptr vec() exprtk_override
{
return temp_vec_node_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecvecarith;
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return vds_.size();
}
- vds_t& vds()
+ vds_t& vds() exprtk_override
{
return vds_;
}
- const vds_t& vds() const
+ const vds_t& vds() const exprtk_override
{
return vds_;
}
@@ -11195,23 +11410,24 @@
};
template <typename T, typename Operation>
- class vec_binop_vecval_node : public binary_node <T>,
- public vector_interface<T>
+ class vec_binop_vecval_node exprtk_final
+ : public binary_node <T>
+ , public vector_interface<T>
{
public:
- typedef expression_node<T>* expression_ptr;
- typedef vector_node<T>* vector_node_ptr;
+ typedef expression_node<T>* expression_ptr;
+ typedef vector_node<T>* vector_node_ptr;
typedef vector_holder<T>* vector_holder_ptr;
- typedef vec_data_store<T> vds_t;
+ typedef vec_data_store<T> vds_t;
vec_binop_vecval_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- vec0_node_ptr_(0),
- temp_ (0),
- temp_vec_node_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , vec0_node_ptr_(0)
+ , temp_ (0)
+ , temp_vec_node_(0)
{
bool v0_is_ivec = false;
@@ -11238,7 +11454,7 @@
vds() = vds_t(vec0_node_ptr_->size());
temp_ = new vector_holder<T>(vds());
- temp_vec_node_ = new vector_node<T> (vds(),temp_);
+ temp_vec_node_ = new vector_node <T>(vds(),temp_);
}
}
@@ -11248,7 +11464,7 @@
delete temp_vec_node_;
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (vec0_node_ptr_)
{
@@ -11314,32 +11530,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- vector_node_ptr vec() const
+ vector_node_ptr vec() const exprtk_override
{
return temp_vec_node_;
}
- vector_node_ptr vec()
+ vector_node_ptr vec() exprtk_override
{
return temp_vec_node_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecvalarith;
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return vds().size();
}
- vds_t& vds()
+ vds_t& vds() exprtk_override
{
return vds_;
}
- const vds_t& vds() const
+ const vds_t& vds() const exprtk_override
{
return vds_;
}
@@ -11353,23 +11569,24 @@
};
template <typename T, typename Operation>
- class vec_binop_valvec_node : public binary_node <T>,
- public vector_interface<T>
+ class vec_binop_valvec_node exprtk_final
+ : public binary_node <T>
+ , public vector_interface<T>
{
public:
- typedef expression_node<T>* expression_ptr;
- typedef vector_node<T>* vector_node_ptr;
+ typedef expression_node<T>* expression_ptr;
+ typedef vector_node<T>* vector_node_ptr;
typedef vector_holder<T>* vector_holder_ptr;
- typedef vec_data_store<T> vds_t;
+ typedef vec_data_store<T> vds_t;
vec_binop_valvec_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- vec1_node_ptr_(0),
- temp_ (0),
- temp_vec_node_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , vec1_node_ptr_(0)
+ , temp_ (0)
+ , temp_vec_node_(0)
{
bool v1_is_ivec = false;
@@ -11396,7 +11613,7 @@
vds() = vds_t(vec1_node_ptr_->size());
temp_ = new vector_holder<T>(vds());
- temp_vec_node_ = new vector_node<T> (vds(),temp_);
+ temp_vec_node_ = new vector_node <T>(vds(),temp_);
}
}
@@ -11406,7 +11623,7 @@
delete temp_vec_node_;
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (vec1_node_ptr_)
{
@@ -11472,32 +11689,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- vector_node_ptr vec() const
+ vector_node_ptr vec() const exprtk_override
{
return temp_vec_node_;
}
- vector_node_ptr vec()
+ vector_node_ptr vec() exprtk_override
{
return temp_vec_node_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecvalarith;
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return vds().size();
}
- vds_t& vds()
+ vds_t& vds() exprtk_override
{
return vds_;
}
- const vds_t& vds() const
+ const vds_t& vds() const exprtk_override
{
return vds_;
}
@@ -11511,21 +11728,22 @@
};
template <typename T, typename Operation>
- class unary_vector_node : public unary_node <T>,
- public vector_interface<T>
+ class unary_vector_node exprtk_final
+ : public unary_node <T>
+ , public vector_interface<T>
{
public:
- typedef expression_node<T>* expression_ptr;
- typedef vector_node<T>* vector_node_ptr;
+ typedef expression_node<T>* expression_ptr;
+ typedef vector_node<T>* vector_node_ptr;
typedef vector_holder<T>* vector_holder_ptr;
- typedef vec_data_store<T> vds_t;
+ typedef vec_data_store<T> vds_t;
unary_vector_node(const operator_type& opr, expression_ptr branch0)
- : unary_node<T>(opr, branch0),
- vec0_node_ptr_(0),
- temp_ (0),
- temp_vec_node_(0)
+ : unary_node<T>(opr, branch0)
+ , vec0_node_ptr_(0)
+ , temp_ (0)
+ , temp_vec_node_(0)
{
bool vec0_is_ivec = false;
@@ -11552,7 +11770,7 @@
vds_ = vds_t(vec0_node_ptr_->size());
temp_ = new vector_holder<T>(vds());
- temp_vec_node_ = new vector_node<T> (vds(),temp_);
+ temp_vec_node_ = new vector_node <T>(vds(),temp_);
}
}
@@ -11562,7 +11780,7 @@
delete temp_vec_node_;
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(unary_node<T>::branch_.first);
@@ -11626,32 +11844,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- vector_node_ptr vec() const
+ vector_node_ptr vec() const exprtk_override
{
return temp_vec_node_;
}
- vector_node_ptr vec()
+ vector_node_ptr vec() exprtk_override
{
return temp_vec_node_;
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vecunaryop;
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return vds().size();
}
- vds_t& vds()
+ vds_t& vds() exprtk_override
{
return vds_;
}
- const vds_t& vds() const
+ const vds_t& vds() const exprtk_override
{
return vds_;
}
@@ -11665,7 +11883,167 @@
};
template <typename T>
- class scand_node : public binary_node<T>
+ class conditional_vector_node exprtk_final
+ : public expression_node <T>
+ , public vector_interface<T>
+ {
+ public:
+
+ typedef expression_node <T>* expression_ptr;
+ typedef vector_interface<T>* vec_interface_ptr;
+ typedef vector_node <T>* vector_node_ptr;
+ typedef vector_holder <T>* vector_holder_ptr;
+ typedef vec_data_store <T> vds_t;
+ typedef std::pair<expression_ptr,bool> branch_t;
+
+ conditional_vector_node(expression_ptr condition,
+ expression_ptr consequent,
+ expression_ptr alternative)
+ : consequent_node_ptr_ (0)
+ , alternative_node_ptr_(0)
+ , temp_vec_node_ (0)
+ , temp_ (0)
+ , vec_size_ (0)
+ , initialised_ (false)
+ {
+ construct_branch_pair(condition_ , condition );
+ construct_branch_pair(consequent_ , consequent );
+ construct_branch_pair(alternative_, alternative);
+
+ if (details::is_ivector_node(consequent_.first))
+ {
+ vec_interface_ptr ivec_ptr = dynamic_cast<vec_interface_ptr>(consequent_.first);
+
+ if (0 != ivec_ptr)
+ {
+ consequent_node_ptr_ = ivec_ptr->vec();
+ }
+ }
+
+ if (details::is_ivector_node(alternative_.first))
+ {
+ vec_interface_ptr ivec_ptr = dynamic_cast<vec_interface_ptr>(alternative_.first);
+
+ if (0 != ivec_ptr)
+ {
+ alternative_node_ptr_ = ivec_ptr->vec();
+ }
+ }
+
+ if (consequent_node_ptr_ && alternative_node_ptr_)
+ {
+ vec_size_ = std::min(consequent_node_ptr_ ->vds().size(),
+ alternative_node_ptr_->vds().size());
+
+ vds_ = vds_t(vec_size_);
+ temp_ = new vector_holder<T>(vds_);
+ temp_vec_node_ = new vector_node <T>(vds(),temp_);
+
+ initialised_ = true;
+ }
+
+ assert(initialised_ && (vec_size_ > 0));
+ }
+
+ ~conditional_vector_node()
+ {
+ delete temp_;
+ delete temp_vec_node_;
+ }
+
+ inline T value() const exprtk_override
+ {
+ if (initialised_)
+ {
+ assert(condition_ .first);
+ assert(consequent_ .first);
+ assert(alternative_.first);
+
+ T result = T(0);
+ T* source_vector = 0;
+ T* result_vector = vds().data();
+
+ if (is_true(condition_))
+ {
+ result = consequent_.first->value();
+ source_vector = consequent_node_ptr_->vds().data();
+ }
+ else
+ {
+ result = alternative_.first->value();
+ source_vector = alternative_node_ptr_->vds().data();
+ }
+
+ for (std::size_t i = 0; i < vec_size_; ++i)
+ {
+ result_vector[i] = source_vector[i];
+ }
+
+ return result;
+ }
+
+ return std::numeric_limits<T>::quiet_NaN();
+ }
+
+ vector_node_ptr vec() const exprtk_override
+ {
+ return temp_vec_node_;
+ }
+
+ vector_node_ptr vec() exprtk_override
+ {
+ return temp_vec_node_;
+ }
+
+ inline typename expression_node<T>::node_type type() const exprtk_override
+ {
+ return expression_node<T>::e_vecondition;
+ }
+
+ std::size_t size() const exprtk_override
+ {
+ return vec_size_;
+ }
+
+ vds_t& vds() exprtk_override
+ {
+ return vds_;
+ }
+
+ const vds_t& vds() const exprtk_override
+ {
+ return vds_;
+ }
+
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
+ {
+ expression_node<T>::ndb_t::collect(condition_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(consequent_ , node_delete_list);
+ expression_node<T>::ndb_t::collect(alternative_ , node_delete_list);
+ }
+
+ std::size_t node_depth() const exprtk_override
+ {
+ return expression_node<T>::ndb_t::compute_node_depth
+ (condition_, consequent_, alternative_);
+ }
+
+ private:
+
+ branch_t condition_;
+ branch_t consequent_;
+ branch_t alternative_;
+ vector_node_ptr consequent_node_ptr_;
+ vector_node_ptr alternative_node_ptr_;
+ vector_node_ptr temp_vec_node_;
+ vector_holder_ptr temp_;
+ vds_t vds_;
+ std::size_t vec_size_;
+ bool initialised_;
+ };
+
+ template <typename T>
+ class scand_node exprtk_final : public binary_node<T>
{
public:
@@ -11677,7 +12055,7 @@
: binary_node<T>(opr, branch0, branch1)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(binary_node<T>::branch_[0].first);
assert(binary_node<T>::branch_[1].first);
@@ -11692,7 +12070,7 @@
};
template <typename T>
- class scor_node : public binary_node<T>
+ class scor_node exprtk_final : public binary_node<T>
{
public:
@@ -11704,7 +12082,7 @@
: binary_node<T>(opr, branch0, branch1)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(binary_node<T>::branch_[0].first);
assert(binary_node<T>::branch_[1].first);
@@ -11719,7 +12097,7 @@
};
template <typename T, typename IFunction, std::size_t N>
- class function_N_node : public expression_node<T>
+ class function_N_node exprtk_final : public expression_node<T>
{
public:
@@ -11729,8 +12107,8 @@
typedef IFunction ifunction;
explicit function_N_node(ifunction* func)
- : function_((N == func->param_count) ? func : reinterpret_cast<ifunction*>(0)),
- parameter_count_(func->param_count)
+ : function_((N == func->param_count) ? func : reinterpret_cast<ifunction*>(0))
+ , parameter_count_(func->param_count)
{}
template <std::size_t NumBranches>
@@ -11764,7 +12142,7 @@
return this < (&fn);
}
- inline T value() const
+ inline T value() const exprtk_override
{
// Needed for incompetent and broken msvc compiler versions
#ifdef _MSC_VER
@@ -11784,6 +12162,21 @@
#endif
}
+ inline typename expression_node<T>::node_type type() const exprtk_override
+ {
+ return expression_node<T>::e_function;
+ }
+
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
+ {
+ expression_node<T>::ndb_t::template collect(branch_, node_delete_list);
+ }
+
+ std::size_t node_depth() const exprtk_override
+ {
+ return expression_node<T>::ndb_t::template compute_node_depth<N>(branch_);
+ }
+
template <typename T_, std::size_t BranchCount>
struct evaluate_branches
{
@@ -11872,119 +12265,119 @@
struct invoke<T_,18>
{
static inline T_ execute(ifunction& f, T_ (&v)[18])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],v[12],v[13],v[14],v[15],v[16],v[17]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15], v[16], v[17]); }
};
template <typename T_>
struct invoke<T_,17>
{
static inline T_ execute(ifunction& f, T_ (&v)[17])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],v[12],v[13],v[14],v[15],v[16]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15], v[16]); }
};
template <typename T_>
struct invoke<T_,16>
{
static inline T_ execute(ifunction& f, T_ (&v)[16])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],v[12],v[13],v[14],v[15]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15]); }
};
template <typename T_>
struct invoke<T_,15>
{
static inline T_ execute(ifunction& f, T_ (&v)[15])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],v[12],v[13],v[14]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12], v[13], v[14]); }
};
template <typename T_>
struct invoke<T_,14>
{
static inline T_ execute(ifunction& f, T_ (&v)[14])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],v[12],v[13]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12], v[13]); }
};
template <typename T_>
struct invoke<T_,13>
{
static inline T_ execute(ifunction& f, T_ (&v)[13])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11],v[12]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12]); }
};
template <typename T_>
struct invoke<T_,12>
{
static inline T_ execute(ifunction& f, T_ (&v)[12])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10],v[11]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11]); }
};
template <typename T_>
struct invoke<T_,11>
{
static inline T_ execute(ifunction& f, T_ (&v)[11])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9],v[10]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10]); }
};
template <typename T_>
struct invoke<T_,10>
{
static inline T_ execute(ifunction& f, T_ (&v)[10])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8],v[9]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9]); }
};
template <typename T_>
struct invoke<T_,9>
{
static inline T_ execute(ifunction& f, T_ (&v)[9])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8]); }
};
template <typename T_>
struct invoke<T_,8>
{
static inline T_ execute(ifunction& f, T_ (&v)[8])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]); }
};
template <typename T_>
struct invoke<T_,7>
{
static inline T_ execute(ifunction& f, T_ (&v)[7])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5],v[6]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5], v[6]); }
};
template <typename T_>
struct invoke<T_,6>
{
static inline T_ execute(ifunction& f, T_ (&v)[6])
- { return f(v[0],v[1],v[2],v[3],v[4],v[5]); }
+ { return f(v[0], v[1], v[2], v[3], v[4], v[5]); }
};
template <typename T_>
struct invoke<T_,5>
{
static inline T_ execute(ifunction& f, T_ (&v)[5])
- { return f(v[0],v[1],v[2],v[3],v[4]); }
+ { return f(v[0], v[1], v[2], v[3], v[4]); }
};
template <typename T_>
struct invoke<T_,4>
{
static inline T_ execute(ifunction& f, T_ (&v)[4])
- { return f(v[0],v[1],v[2],v[3]); }
+ { return f(v[0], v[1], v[2], v[3]); }
};
template <typename T_>
struct invoke<T_,3>
{
static inline T_ execute(ifunction& f, T_ (&v)[3])
- { return f(v[0],v[1],v[2]); }
+ { return f(v[0], v[1], v[2]); }
};
template <typename T_>
struct invoke<T_,2>
{
static inline T_ execute(ifunction& f, T_ (&v)[2])
- { return f(v[0],v[1]); }
+ { return f(v[0], v[1]); }
};
template <typename T_>
@@ -11994,21 +12387,6 @@
{ return f(v[0]); }
};
- inline typename expression_node<T>::node_type type() const
- {
- return expression_node<T>::e_function;
- }
-
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
- {
- expression_node<T>::ndb_t::template collect(branch_, node_delete_list);
- }
-
- std::size_t node_depth() const
- {
- return expression_node<T>::ndb_t::template compute_node_depth<N>(branch_);
- }
-
private:
ifunction* function_;
@@ -12017,7 +12395,7 @@
};
template <typename T, typename IFunction>
- class function_N_node<T,IFunction,0> : public expression_node<T>
+ class function_N_node<T,IFunction,0> exprtk_final : public expression_node<T>
{
public:
@@ -12033,7 +12411,7 @@
return this < (&fn);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (function_)
return (*function_)();
@@ -12041,7 +12419,7 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_function;
}
@@ -12052,7 +12430,7 @@
};
template <typename T, typename VarArgFunction>
- class vararg_function_node : public expression_node<T>
+ class vararg_function_node exprtk_final : public expression_node<T>
{
public:
@@ -12060,8 +12438,8 @@
vararg_function_node(VarArgFunction* func,
const std::vector<expression_ptr>& arg_list)
- : function_(func),
- arg_list_(arg_list)
+ : function_(func)
+ , arg_list_(arg_list)
{
value_list_.resize(arg_list.size(),std::numeric_limits<T>::quiet_NaN());
}
@@ -12071,7 +12449,7 @@
return this < (&fn);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (function_)
{
@@ -12082,12 +12460,12 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_vafunction;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
for (std::size_t i = 0; i < arg_list_.size(); ++i)
{
@@ -12098,7 +12476,7 @@
}
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(arg_list_);
}
@@ -12123,36 +12501,37 @@
{
public:
- typedef type_store<T> type_store_t;
- typedef expression_node<T>* expression_ptr;
- typedef variable_node<T> variable_node_t;
- typedef vector_node<T> vector_node_t;
- typedef variable_node_t* variable_node_ptr_t;
- typedef vector_node_t* vector_node_ptr_t;
- typedef range_interface<T> range_interface_t;
- typedef range_data_type<T> range_data_type_t;
- typedef range_pack<T> range_t;
- typedef std::pair<expression_ptr,bool> branch_t;
- typedef std::pair<void*,std::size_t> void_t;
- typedef std::vector<T> tmp_vs_t;
- typedef std::vector<type_store_t> typestore_list_t;
- typedef std::vector<range_data_type_t> range_list_t;
+ typedef type_store<T> type_store_t;
+ typedef expression_node<T>* expression_ptr;
+ typedef variable_node<T> variable_node_t;
+ typedef vector_node<T> vector_node_t;
+ typedef variable_node_t* variable_node_ptr_t;
+ typedef vector_node_t* vector_node_ptr_t;
+ typedef range_interface<T> range_interface_t;
+ typedef range_data_type<T> range_data_type_t;
+ typedef typename range_interface<T>::range_t range_t;
+
+ typedef std::pair<expression_ptr,bool> branch_t;
+ typedef std::pair<void*,std::size_t> void_t;
+
+ typedef std::vector<T> tmp_vs_t;
+ typedef std::vector<type_store_t> typestore_list_t;
+ typedef std::vector<range_data_type_t> range_list_t;
explicit generic_function_node(const std::vector<expression_ptr>& arg_list,
- GenericFunction* func = (GenericFunction*)(0))
- : function_(func),
- arg_list_(arg_list)
+ GenericFunction* func = reinterpret_cast<GenericFunction*>(0))
+ : function_(func)
+ , arg_list_(arg_list)
{}
- virtual ~generic_function_node()
- {}
+ virtual ~generic_function_node() {}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override exprtk_final
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
@@ -12162,7 +12541,7 @@
expr_as_vec1_store_.resize(arg_list_.size(),T(0) );
typestore_list_ .resize(arg_list_.size(),type_store_t() );
range_list_ .resize(arg_list_.size(),range_data_type_t());
- branch_ .resize(arg_list_.size(),branch_t((expression_ptr)0,false));
+ branch_ .resize(arg_list_.size(),branch_t(reinterpret_cast<expression_ptr>(0),false));
for (std::size_t i = 0; i < arg_list_.size(); ++i)
{
@@ -12248,7 +12627,7 @@
return this < (&fn);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (function_)
{
@@ -12263,7 +12642,7 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_genfunction;
}
@@ -12327,7 +12706,7 @@
public:
typedef generic_function_node<T,StringFunction> gen_function_t;
- typedef range_pack<T> range_t;
+ typedef typename range_interface<T>::range_t range_t;
string_function_node(StringFunction* func,
const std::vector<typename gen_function_t::expression_ptr>& arg_list)
@@ -12344,7 +12723,7 @@
return this < (&fn);
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (gen_function_t::function_)
{
@@ -12368,32 +12747,32 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_strfunction;
}
- std::string str() const
+ std::string str() const exprtk_override
{
return ret_string_;
}
- char_cptr base() const
+ char_cptr base() const exprtk_override
{
return &ret_string_[0];
}
- std::size_t size() const
+ std::size_t size() const exprtk_override
{
return ret_string_.size();
}
- range_t& range_ref()
+ range_t& range_ref() exprtk_override
{
return range_;
}
- const range_t& range_ref() const
+ const range_t& range_ref() const exprtk_override
{
return range_;
}
@@ -12411,16 +12790,16 @@
public:
typedef generic_function_node<T,GenericFunction> gen_function_t;
- typedef range_pack<T> range_t;
+ typedef typename gen_function_t::range_t range_t;
multimode_genfunction_node(GenericFunction* func,
const std::size_t& param_seq_index,
const std::vector<typename gen_function_t::expression_ptr>& arg_list)
- : gen_function_t(arg_list,func),
- param_seq_index_(param_seq_index)
+ : gen_function_t(arg_list,func)
+ , param_seq_index_(param_seq_index)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
if (gen_function_t::function_)
{
@@ -12439,7 +12818,7 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override exprtk_final
{
return expression_node<T>::e_genfunction;
}
@@ -12451,21 +12830,21 @@
#ifndef exprtk_disable_string_capabilities
template <typename T, typename StringFunction>
- class multimode_strfunction_node : public string_function_node<T,StringFunction>
+ class multimode_strfunction_node exprtk_final : public string_function_node<T,StringFunction>
{
public:
typedef string_function_node<T,StringFunction> str_function_t;
- typedef range_pack<T> range_t;
+ typedef typename str_function_t::range_t range_t;
multimode_strfunction_node(StringFunction* func,
const std::size_t& param_seq_index,
const std::vector<typename str_function_t::expression_ptr>& arg_list)
- : str_function_t(func,arg_list),
- param_seq_index_(param_seq_index)
+ : str_function_t(func,arg_list)
+ , param_seq_index_(param_seq_index)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
if (str_function_t::function_)
{
@@ -12490,7 +12869,7 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_strfunction;
}
@@ -12509,8 +12888,7 @@
{
public:
- virtual ~null_igenfunc()
- {}
+ virtual ~null_igenfunc() {}
typedef type_store<T> generic_type;
typedef typename generic_type::parameter_list parameter_list_t;
@@ -12523,22 +12901,22 @@
#ifndef exprtk_disable_return_statement
template <typename T>
- class return_node : public generic_function_node<T,null_igenfunc<T> >
+ class return_node exprtk_final : public generic_function_node<T,null_igenfunc<T> >
{
public:
- typedef null_igenfunc<T> igeneric_function_t;
+ typedef results_context<T> results_context_t;
+ typedef null_igenfunc<T> igeneric_function_t;
typedef igeneric_function_t* igeneric_function_ptr;
typedef generic_function_node<T,igeneric_function_t> gen_function_t;
- typedef results_context<T> results_context_t;
return_node(const std::vector<typename gen_function_t::expression_ptr>& arg_list,
results_context_t& rc)
- : gen_function_t (arg_list),
- results_context_(&rc)
+ : gen_function_t (arg_list)
+ , results_context_(&rc)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
if (
(0 != results_context_) &&
@@ -12556,7 +12934,7 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_return;
}
@@ -12567,7 +12945,7 @@
};
template <typename T>
- class return_envelope_node : public expression_node<T>
+ class return_envelope_node exprtk_final : public expression_node<T>
{
public:
@@ -12576,13 +12954,13 @@
typedef std::pair<expression_ptr,bool> branch_t;
return_envelope_node(expression_ptr body, results_context_t& rc)
- : results_context_(&rc ),
- return_invoked_ (false)
+ : results_context_(&rc )
+ , return_invoked_ (false)
{
construct_branch_pair(body_, body);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(body_.first);
@@ -12600,7 +12978,7 @@
}
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_retenv;
}
@@ -12610,12 +12988,12 @@
return &return_invoked_;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(body_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(body_);
}
@@ -12698,11 +13076,11 @@
{
typedef typename details::functor_t<T>::Type Type;
typedef typename details::functor_t<T>::RefType RefType;
- typedef typename details::functor_t<T> functor_t;
- typedef typename functor_t::qfunc_t quaternary_functor_t;
- typedef typename functor_t::tfunc_t trinary_functor_t;
- typedef typename functor_t::bfunc_t binary_functor_t;
- typedef typename functor_t::ufunc_t unary_functor_t;
+ typedef typename details::functor_t<T> functor_t;
+ typedef typename functor_t::qfunc_t quaternary_functor_t;
+ typedef typename functor_t::tfunc_t trinary_functor_t;
+ typedef typename functor_t::bfunc_t binary_functor_t;
+ typedef typename functor_t::ufunc_t unary_functor_t;
};
template <typename T>
@@ -13858,8 +14236,7 @@
{
public:
- virtual ~vov_base_node()
- {}
+ virtual ~vov_base_node() {}
inline virtual operator_type operation() const
{
@@ -13876,8 +14253,7 @@
{
public:
- virtual ~cov_base_node()
- {}
+ virtual ~cov_base_node() {}
inline virtual operator_type operation() const
{
@@ -13894,8 +14270,7 @@
{
public:
- virtual ~voc_base_node()
- {}
+ virtual ~voc_base_node() {}
inline virtual operator_type operation() const
{
@@ -13912,8 +14287,7 @@
{
public:
- virtual ~vob_base_node()
- {}
+ virtual ~vob_base_node() {}
virtual const T& v() const = 0;
};
@@ -13923,8 +14297,7 @@
{
public:
- virtual ~bov_base_node()
- {}
+ virtual ~bov_base_node() {}
virtual const T& v() const = 0;
};
@@ -13934,8 +14307,7 @@
{
public:
- virtual ~cob_base_node()
- {}
+ virtual ~cob_base_node() {}
inline virtual operator_type operation() const
{
@@ -13954,8 +14326,7 @@
{
public:
- virtual ~boc_base_node()
- {}
+ virtual ~boc_base_node() {}
inline virtual operator_type operation() const
{
@@ -13974,8 +14345,7 @@
{
public:
- virtual ~uv_base_node()
- {}
+ virtual ~uv_base_node() {}
inline virtual operator_type operation() const
{
@@ -13990,8 +14360,7 @@
{
public:
- virtual ~sos_base_node()
- {}
+ virtual ~sos_base_node() {}
inline virtual operator_type operation() const
{
@@ -14004,8 +14373,7 @@
{
public:
- virtual ~sosos_base_node()
- {}
+ virtual ~sosos_base_node() {}
inline virtual operator_type operation() const
{
@@ -14018,8 +14386,7 @@
{
public:
- virtual ~T0oT1oT2_base_node()
- {}
+ virtual ~T0oT1oT2_base_node() {}
virtual std::string type_id() const = 0;
};
@@ -14029,14 +14396,13 @@
{
public:
- virtual ~T0oT1oT2oT3_base_node()
- {}
+ virtual ~T0oT1oT2oT3_base_node() {}
virtual std::string type_id() const = 0;
};
template <typename T, typename Operation>
- class unary_variable_node : public uv_base_node<T>
+ class unary_variable_node exprtk_final : public uv_base_node<T>
{
public:
@@ -14047,70 +14413,64 @@
: v_(var)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return Operation::process(v_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return Operation::type();
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return Operation::operation();
}
- inline const T& v() const
+ inline const T& v() const exprtk_override
{
return v_;
}
private:
- unary_variable_node(unary_variable_node<T,Operation>&);
- unary_variable_node<T,Operation>& operator=(unary_variable_node<T,Operation>&);
+ unary_variable_node(const unary_variable_node<T,Operation>&) exprtk_delete;
+ unary_variable_node<T,Operation>& operator=(const unary_variable_node<T,Operation>&) exprtk_delete;
const T& v_;
};
template <typename T>
- class uvouv_node : public expression_node<T>
+ class uvouv_node exprtk_final : public expression_node<T>
{
public:
// UOpr1(v0) Op UOpr2(v1)
-
- typedef expression_node<T>* expression_ptr;
typedef typename details::functor_t<T> functor_t;
- typedef typename functor_t::bfunc_t bfunc_t;
- typedef typename functor_t::ufunc_t ufunc_t;
+ typedef typename functor_t::bfunc_t bfunc_t;
+ typedef typename functor_t::ufunc_t ufunc_t;
+ typedef expression_node<T>* expression_ptr;
explicit uvouv_node(const T& var0,const T& var1,
ufunc_t uf0, ufunc_t uf1, bfunc_t bf)
- : v0_(var0),
- v1_(var1),
- u0_(uf0 ),
- u1_(uf1 ),
- f_ (bf )
+ : v0_(var0)
+ , v1_(var1)
+ , u0_(uf0 )
+ , u1_(uf1 )
+ , f_ (bf )
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return f_(u0_(v0_),u1_(v1_));
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_uvouv;
}
- inline operator_type operation() const
- {
- return details::e_default;
- }
-
inline const T& v0()
{
return v0_;
@@ -14138,8 +14498,8 @@
private:
- uvouv_node(uvouv_node<T>&);
- uvouv_node<T>& operator=(uvouv_node<T>&);
+ uvouv_node(const uvouv_node<T>&) exprtk_delete;
+ uvouv_node<T>& operator=(const uvouv_node<T>&) exprtk_delete;
const T& v0_;
const T& v1_;
@@ -14149,35 +14509,35 @@
};
template <typename T, typename Operation>
- class unary_branch_node : public expression_node<T>
+ class unary_branch_node exprtk_final : public expression_node<T>
{
public:
- typedef expression_node<T>* expression_ptr;
+ typedef Operation operation_t;
+ typedef expression_node<T>* expression_ptr;
typedef std::pair<expression_ptr,bool> branch_t;
- typedef Operation operation_t;
explicit unary_branch_node(expression_ptr branch)
{
construct_branch_pair(branch_, branch);
}
- inline T value() const
+ inline T value() const exprtk_override
{
return Operation::process(branch_.first->value());
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return Operation::type();
}
- inline operator_type operation() const
+ inline operator_type operation()
{
return Operation::operation();
}
- inline expression_node<T>* branch(const std::size_t&) const
+ inline expression_node<T>* branch(const std::size_t&) const exprtk_override
{
return branch_.first;
}
@@ -14187,20 +14547,20 @@
branch_.second = false;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
private:
- unary_branch_node(unary_branch_node<T,Operation>&);
- unary_branch_node<T,Operation>& operator=(unary_branch_node<T,Operation>&);
+ unary_branch_node(const unary_branch_node<T,Operation>&) exprtk_delete;
+ unary_branch_node<T,Operation>& operator=(const unary_branch_node<T,Operation>&) exprtk_delete;
branch_t branch_;
};
@@ -14226,7 +14586,7 @@
struct T0oT1oT2process
{
typedef typename details::functor_t<T> functor_t;
- typedef typename functor_t::bfunc_t bfunc_t;
+ typedef typename functor_t::bfunc_t bfunc_t;
struct mode0
{
@@ -14269,7 +14629,7 @@
struct T0oT1oT20T3process
{
typedef typename details::functor_t<T> functor_t;
- typedef typename functor_t::bfunc_t bfunc_t;
+ typedef typename functor_t::bfunc_t bfunc_t;
struct mode0
{
@@ -14383,7 +14743,7 @@
template <typename T, typename T0, typename T1>
const typename expression_node<T>::node_type nodetype_T0oT1<T,T0,T1>::result = expression_node<T>::e_none;
- #define synthesis_node_type_define(T0_,T1_,v_) \
+ #define synthesis_node_type_define(T0_, T1_, v_) \
template <typename T, typename T0, typename T1> \
struct nodetype_T0oT1<T,T0_,T1_> { static const typename expression_node<T>::node_type result; }; \
template <typename T, typename T0, typename T1> \
@@ -14405,7 +14765,7 @@
template <typename T, typename T0, typename T1, typename T2>
const typename expression_node<T>::node_type nodetype_T0oT1oT2<T,T0,T1,T2>::result = expression_node<T>::e_none;
- #define synthesis_node_type_define(T0_,T1_,T2_,v_) \
+ #define synthesis_node_type_define(T0_, T1_, T2_, v_) \
template <typename T, typename T0, typename T1, typename T2> \
struct nodetype_T0oT1oT2<T,T0_,T1_,T2_> { static const typename expression_node<T>::node_type result; }; \
template <typename T, typename T0, typename T1, typename T2> \
@@ -14427,7 +14787,7 @@
template <typename T, typename T0, typename T1, typename T2, typename T3>
const typename expression_node<T>::node_type nodetype_T0oT1oT2oT3<T,T0,T1,T2,T3>::result = expression_node<T>::e_none;
- #define synthesis_node_type_define(T0_,T1_,T2_,T3_,v_) \
+ #define synthesis_node_type_define(T0_, T1_, T2_, T3_, v_) \
template <typename T, typename T0, typename T1, typename T2, typename T3> \
struct nodetype_T0oT1oT2oT3<T,T0_,T1_,T2_,T3_> { static const typename expression_node<T>::node_type result; }; \
template <typename T, typename T0, typename T1, typename T2, typename T3> \
@@ -14452,33 +14812,33 @@
#undef synthesis_node_type_define
template <typename T, typename T0, typename T1>
- class T0oT1 : public expression_node<T>
+ class T0oT1 exprtk_final : public expression_node<T>
{
public:
typedef typename details::functor_t<T> functor_t;
- typedef typename functor_t::bfunc_t bfunc_t;
+ typedef typename functor_t::bfunc_t bfunc_t;
typedef T value_type;
typedef T0oT1<T,T0,T1> node_type;
T0oT1(T0 p0, T1 p1, const bfunc_t p2)
- : t0_(p0),
- t1_(p1),
- f_ (p2)
+ : t0_(p0)
+ , t1_(p1)
+ , f_ (p2)
{}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
static const typename expression_node<T>::node_type result = nodetype_T0oT1<T,T0,T1>::result;
return result;
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return e_default;
}
- inline T value() const
+ inline T value() const exprtk_override
{
return f_(t0_,t1_);
}
@@ -14510,8 +14870,8 @@
private:
- T0oT1(T0oT1<T,T0,T1>&) {}
- T0oT1<T,T0,T1>& operator=(T0oT1<T,T0,T1>&) { return (*this); }
+ T0oT1(const T0oT1<T,T0,T1>&) exprtk_delete;
+ T0oT1<T,T0,T1>& operator=(const T0oT1<T,T0,T1>&) { return (*this); }
T0 t0_;
T1 t1_;
@@ -14519,36 +14879,36 @@
};
template <typename T, typename T0, typename T1, typename T2, typename ProcessMode>
- class T0oT1oT2 : public T0oT1oT2_base_node<T>
+ class T0oT1oT2 exprtk_final : public T0oT1oT2_base_node<T>
{
public:
typedef typename details::functor_t<T> functor_t;
- typedef typename functor_t::bfunc_t bfunc_t;
+ typedef typename functor_t::bfunc_t bfunc_t;
typedef T value_type;
typedef T0oT1oT2<T,T0,T1,T2,ProcessMode> node_type;
typedef ProcessMode process_mode_t;
T0oT1oT2(T0 p0, T1 p1, T2 p2, const bfunc_t p3, const bfunc_t p4)
- : t0_(p0),
- t1_(p1),
- t2_(p2),
- f0_(p3),
- f1_(p4)
+ : t0_(p0)
+ , t1_(p1)
+ , t2_(p2)
+ , f0_(p3)
+ , f1_(p4)
{}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
static const typename expression_node<T>::node_type result = nodetype_T0oT1oT2<T,T0,T1,T2>::result;
return result;
}
- inline operator_type operation() const
+ inline operator_type operation()
{
return e_default;
}
- inline T value() const
+ inline T value() const exprtk_override
{
return ProcessMode::process(t0_, t1_, t2_, f0_, f1_);
}
@@ -14578,7 +14938,7 @@
return f1_;
}
- std::string type_id() const
+ std::string type_id() const exprtk_override
{
return id();
}
@@ -14598,8 +14958,8 @@
private:
- T0oT1oT2(node_type&) {}
- node_type& operator=(node_type&) { return (*this); }
+ T0oT1oT2(const node_type&) exprtk_delete;
+ node_type& operator=(const node_type&) { return (*this); }
T0 t0_;
T1 t1_;
@@ -14609,12 +14969,12 @@
};
template <typename T, typename T0_, typename T1_, typename T2_, typename T3_, typename ProcessMode>
- class T0oT1oT2oT3 : public T0oT1oT2oT3_base_node<T>
+ class T0oT1oT2oT3 exprtk_final : public T0oT1oT2oT3_base_node<T>
{
public:
typedef typename details::functor_t<T> functor_t;
- typedef typename functor_t::bfunc_t bfunc_t;
+ typedef typename functor_t::bfunc_t bfunc_t;
typedef T value_type;
typedef T0_ T0;
typedef T1_ T1;
@@ -14624,16 +14984,16 @@
typedef ProcessMode process_mode_t;
T0oT1oT2oT3(T0 p0, T1 p1, T2 p2, T3 p3, bfunc_t p4, bfunc_t p5, bfunc_t p6)
- : t0_(p0),
- t1_(p1),
- t2_(p2),
- t3_(p3),
- f0_(p4),
- f1_(p5),
- f2_(p6)
+ : t0_(p0)
+ , t1_(p1)
+ , t2_(p2)
+ , t3_(p3)
+ , f0_(p4)
+ , f1_(p5)
+ , f2_(p6)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return ProcessMode::process(t0_, t1_, t2_, t3_, f0_, f1_, f2_);
}
@@ -14673,7 +15033,7 @@
return f2_;
}
- inline std::string type_id() const
+ inline std::string type_id() const exprtk_override
{
return id();
}
@@ -14695,8 +15055,8 @@
private:
- T0oT1oT2oT3(node_type&) {}
- node_type& operator=(node_type&) { return (*this); }
+ T0oT1oT2oT3(const node_type&) exprtk_delete;
+ node_type& operator=(const node_type&) { return (*this); }
T0 t0_;
T1 t1_;
@@ -14708,34 +15068,34 @@
};
template <typename T, typename T0, typename T1, typename T2>
- class T0oT1oT2_sf3 : public T0oT1oT2_base_node<T>
+ class T0oT1oT2_sf3 exprtk_final : public T0oT1oT2_base_node<T>
{
public:
typedef typename details::functor_t<T> functor_t;
- typedef typename functor_t::tfunc_t tfunc_t;
+ typedef typename functor_t::tfunc_t tfunc_t;
typedef T value_type;
typedef T0oT1oT2_sf3<T,T0,T1,T2> node_type;
T0oT1oT2_sf3(T0 p0, T1 p1, T2 p2, const tfunc_t p3)
- : t0_(p0),
- t1_(p1),
- t2_(p2),
- f_ (p3)
+ : t0_(p0)
+ , t1_(p1)
+ , t2_(p2)
+ , f_ (p3)
{}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
static const typename expression_node<T>::node_type result = nodetype_T0oT1oT2<T,T0,T1,T2>::result;
return result;
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return e_default;
}
- inline T value() const
+ inline T value() const exprtk_override
{
return f_(t0_, t1_, t2_);
}
@@ -14780,8 +15140,8 @@
private:
- T0oT1oT2_sf3(node_type&) {}
- node_type& operator=(node_type&) { return (*this); }
+ T0oT1oT2_sf3(const node_type&) exprtk_delete;
+ node_type& operator=(const node_type&) { return (*this); }
T0 t0_;
T1 t1_;
@@ -14794,8 +15154,7 @@
{
public:
- virtual ~sf3ext_type_node()
- {}
+ virtual ~sf3ext_type_node() {}
virtual T0 t0() const = 0;
@@ -14805,53 +15164,53 @@
};
template <typename T, typename T0, typename T1, typename T2, typename SF3Operation>
- class T0oT1oT2_sf3ext : public sf3ext_type_node<T,T0,T1,T2>
+ class T0oT1oT2_sf3ext exprtk_final : public sf3ext_type_node<T,T0,T1,T2>
{
public:
typedef typename details::functor_t<T> functor_t;
- typedef typename functor_t::tfunc_t tfunc_t;
+ typedef typename functor_t::tfunc_t tfunc_t;
typedef T value_type;
- typedef T0oT1oT2_sf3ext<T,T0,T1,T2,SF3Operation> node_type;
+ typedef T0oT1oT2_sf3ext<T, T0, T1, T2, SF3Operation> node_type;
T0oT1oT2_sf3ext(T0 p0, T1 p1, T2 p2)
- : t0_(p0),
- t1_(p1),
- t2_(p2)
+ : t0_(p0)
+ , t1_(p1)
+ , t2_(p2)
{}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
static const typename expression_node<T>::node_type result = nodetype_T0oT1oT2<T,T0,T1,T2>::result;
return result;
}
- inline operator_type operation() const
+ inline operator_type operation()
{
return e_default;
}
- inline T value() const
+ inline T value() const exprtk_override
{
return SF3Operation::process(t0_, t1_, t2_);
}
- T0 t0() const
+ T0 t0() const exprtk_override
{
return t0_;
}
- T1 t1() const
+ T1 t1() const exprtk_override
{
return t1_;
}
- T2 t2() const
+ T2 t2() const exprtk_override
{
return t2_;
}
- std::string type_id() const
+ std::string type_id() const exprtk_override
{
return id();
}
@@ -14871,8 +15230,8 @@
private:
- T0oT1oT2_sf3ext(node_type&) {}
- node_type& operator=(node_type&) { return (*this); }
+ T0oT1oT2_sf3ext(const node_type&) exprtk_delete;
+ node_type& operator=(const node_type&) { return (*this); }
T0 t0_;
T1 t1_;
@@ -14894,35 +15253,35 @@
}
template <typename T, typename T0, typename T1, typename T2, typename T3>
- class T0oT1oT2oT3_sf4 : public T0oT1oT2_base_node<T>
+ class T0oT1oT2oT3_sf4 exprtk_final : public T0oT1oT2_base_node<T>
{
public:
typedef typename details::functor_t<T> functor_t;
- typedef typename functor_t::qfunc_t qfunc_t;
+ typedef typename functor_t::qfunc_t qfunc_t;
typedef T value_type;
- typedef T0oT1oT2oT3_sf4<T,T0,T1,T2,T3> node_type;
+ typedef T0oT1oT2oT3_sf4<T, T0, T1, T2, T3> node_type;
T0oT1oT2oT3_sf4(T0 p0, T1 p1, T2 p2, T3 p3, const qfunc_t p4)
- : t0_(p0),
- t1_(p1),
- t2_(p2),
- t3_(p3),
- f_ (p4)
+ : t0_(p0)
+ , t1_(p1)
+ , t2_(p2)
+ , t3_(p3)
+ , f_ (p4)
{}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
static const typename expression_node<T>::node_type result = nodetype_T0oT1oT2oT3<T,T0,T1,T2,T3>::result;
return result;
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return e_default;
}
- inline T value() const
+ inline T value() const exprtk_override
{
return f_(t0_, t1_, t2_, t3_);
}
@@ -14972,8 +15331,8 @@
private:
- T0oT1oT2oT3_sf4(node_type&) {}
- node_type& operator=(node_type&) { return (*this); }
+ T0oT1oT2oT3_sf4(const node_type&) exprtk_delete;
+ node_type& operator=(const node_type&) { return (*this); }
T0 t0_;
T1 t1_;
@@ -14983,34 +15342,29 @@
};
template <typename T, typename T0, typename T1, typename T2, typename T3, typename SF4Operation>
- class T0oT1oT2oT3_sf4ext : public T0oT1oT2oT3_base_node<T>
+ class T0oT1oT2oT3_sf4ext exprtk_final : public T0oT1oT2oT3_base_node<T>
{
public:
typedef typename details::functor_t<T> functor_t;
- typedef typename functor_t::tfunc_t tfunc_t;
+ typedef typename functor_t::tfunc_t tfunc_t;
typedef T value_type;
- typedef T0oT1oT2oT3_sf4ext<T,T0,T1,T2,T3,SF4Operation> node_type;
+ typedef T0oT1oT2oT3_sf4ext<T, T0, T1, T2, T3, SF4Operation> node_type;
T0oT1oT2oT3_sf4ext(T0 p0, T1 p1, T2 p2, T3 p3)
- : t0_(p0),
- t1_(p1),
- t2_(p2),
- t3_(p3)
+ : t0_(p0)
+ , t1_(p1)
+ , t2_(p2)
+ , t3_(p3)
{}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
static const typename expression_node<T>::node_type result = nodetype_T0oT1oT2oT3<T,T0,T1,T2,T3>::result;
return result;
}
- inline operator_type operation() const
- {
- return e_default;
- }
-
- inline T value() const
+ inline T value() const exprtk_override
{
return SF4Operation::process(t0_, t1_, t2_, t3_);
}
@@ -15035,7 +15389,7 @@
return t3_;
}
- std::string type_id() const
+ std::string type_id() const exprtk_override
{
return id();
}
@@ -15055,8 +15409,8 @@
private:
- T0oT1oT2oT3_sf4ext(node_type&) {}
- node_type& operator=(node_type&) { return (*this); }
+ T0oT1oT2oT3_sf4ext(const node_type&) exprtk_delete;
+ node_type& operator=(const node_type&) { return (*this); }
T0 t0_;
T1 t1_;
@@ -15109,7 +15463,7 @@
};
template <typename T, typename Operation>
- class vov_node : public vov_base_node<T>
+ class vov_node exprtk_final : public vov_base_node<T>
{
public:
@@ -15118,31 +15472,31 @@
// variable op variable node
explicit vov_node(const T& var0, const T& var1)
- : v0_(var0),
- v1_(var1)
+ : v0_(var0)
+ , v1_(var1)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return Operation::process(v0_,v1_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return Operation::type();
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return Operation::operation();
}
- inline const T& v0() const
+ inline const T& v0() const exprtk_override
{
return v0_;
}
- inline const T& v1() const
+ inline const T& v1() const exprtk_override
{
return v1_;
}
@@ -15154,12 +15508,12 @@
private:
- vov_node(vov_node<T,Operation>&);
- vov_node<T,Operation>& operator=(vov_node<T,Operation>&);
+ vov_node(const vov_node<T,Operation>&) exprtk_delete;
+ vov_node<T,Operation>& operator=(const vov_node<T,Operation>&) exprtk_delete;
};
template <typename T, typename Operation>
- class cov_node : public cov_base_node<T>
+ class cov_node exprtk_final : public cov_base_node<T>
{
public:
@@ -15168,31 +15522,31 @@
// constant op variable node
explicit cov_node(const T& const_var, const T& var)
- : c_(const_var),
- v_(var)
+ : c_(const_var)
+ , v_(var)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return Operation::process(c_,v_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return Operation::type();
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return Operation::operation();
}
- inline const T c() const
+ inline const T c() const exprtk_override
{
return c_;
}
- inline const T& v() const
+ inline const T& v() const exprtk_override
{
return v_;
}
@@ -15204,12 +15558,12 @@
private:
- cov_node(const cov_node<T,Operation>&);
- cov_node<T,Operation>& operator=(const cov_node<T,Operation>&);
+ cov_node(const cov_node<T,Operation>&) exprtk_delete;
+ cov_node<T,Operation>& operator=(const cov_node<T,Operation>&) exprtk_delete;
};
template <typename T, typename Operation>
- class voc_node : public voc_base_node<T>
+ class voc_node exprtk_final : public voc_base_node<T>
{
public:
@@ -15218,26 +15572,26 @@
// variable op constant node
explicit voc_node(const T& var, const T& const_var)
- : v_(var),
- c_(const_var)
+ : v_(var)
+ , c_(const_var)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return Operation::process(v_,c_);
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return Operation::operation();
}
- inline const T c() const
+ inline const T c() const exprtk_override
{
return c_;
}
- inline const T& v() const
+ inline const T& v() const exprtk_override
{
return v_;
}
@@ -15249,12 +15603,12 @@
private:
- voc_node(const voc_node<T,Operation>&);
- voc_node<T,Operation>& operator=(const voc_node<T,Operation>&);
+ voc_node(const voc_node<T,Operation>&) exprtk_delete;
+ voc_node<T,Operation>& operator=(const voc_node<T,Operation>&) exprtk_delete;
};
template <typename T, typename Operation>
- class vob_node : public vob_base_node<T>
+ class vob_node exprtk_final : public vob_base_node<T>
{
public:
@@ -15269,48 +15623,43 @@
construct_branch_pair(branch_, branch);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(branch_.first);
return Operation::process(v_,branch_.first->value());
}
- inline operator_type operation() const
- {
- return Operation::operation();
- }
-
- inline const T& v() const
+ inline const T& v() const exprtk_override
{
return v_;
}
- inline expression_node<T>* branch(const std::size_t&) const
+ inline expression_node<T>* branch(const std::size_t&) const exprtk_override
{
return branch_.first;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::template collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
private:
- vob_node(const vob_node<T,Operation>&);
- vob_node<T,Operation>& operator=(const vob_node<T,Operation>&);
+ vob_node(const vob_node<T,Operation>&) exprtk_delete;
+ vob_node<T,Operation>& operator=(const vob_node<T,Operation>&) exprtk_delete;
const T& v_;
branch_t branch_;
};
template <typename T, typename Operation>
- class bov_node : public bov_base_node<T>
+ class bov_node exprtk_final : public bov_base_node<T>
{
public:
@@ -15325,48 +15674,43 @@
construct_branch_pair(branch_, branch);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(branch_.first);
return Operation::process(branch_.first->value(),v_);
}
- inline operator_type operation() const
- {
- return Operation::operation();
- }
-
- inline const T& v() const
+ inline const T& v() const exprtk_override
{
return v_;
}
- inline expression_node<T>* branch(const std::size_t&) const
+ inline expression_node<T>* branch(const std::size_t&) const exprtk_override
{
return branch_.first;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::template collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
private:
- bov_node(const bov_node<T,Operation>&);
- bov_node<T,Operation>& operator=(const bov_node<T,Operation>&);
+ bov_node(const bov_node<T,Operation>&) exprtk_delete;
+ bov_node<T,Operation>& operator=(const bov_node<T,Operation>&) exprtk_delete;
const T& v_;
branch_t branch_;
};
template <typename T, typename Operation>
- class cob_node : public cob_base_node<T>
+ class cob_node exprtk_final : public cob_base_node<T>
{
public:
@@ -15381,59 +15725,59 @@
construct_branch_pair(branch_, branch);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(branch_.first);
return Operation::process(c_,branch_.first->value());
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return Operation::operation();
}
- inline const T c() const
+ inline const T c() const exprtk_override
{
return c_;
}
- inline void set_c(const T new_c)
+ inline void set_c(const T new_c) exprtk_override
{
(*const_cast<T*>(&c_)) = new_c;
}
- inline expression_node<T>* branch(const std::size_t&) const
+ inline expression_node<T>* branch(const std::size_t&) const exprtk_override
{
return branch_.first;
}
- inline expression_node<T>* move_branch(const std::size_t&)
+ inline expression_node<T>* move_branch(const std::size_t&) exprtk_override
{
branch_.second = false;
return branch_.first;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::template collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
private:
- cob_node(const cob_node<T,Operation>&);
- cob_node<T,Operation>& operator=(const cob_node<T,Operation>&);
+ cob_node(const cob_node<T,Operation>&) exprtk_delete;
+ cob_node<T,Operation>& operator=(const cob_node<T,Operation>&) exprtk_delete;
const T c_;
branch_t branch_;
};
template <typename T, typename Operation>
- class boc_node : public boc_base_node<T>
+ class boc_node exprtk_final : public boc_base_node<T>
{
public:
@@ -15448,52 +15792,52 @@
construct_branch_pair(branch_, branch);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(branch_.first);
return Operation::process(branch_.first->value(),c_);
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return Operation::operation();
}
- inline const T c() const
+ inline const T c() const exprtk_override
{
return c_;
}
- inline void set_c(const T new_c)
+ inline void set_c(const T new_c) exprtk_override
{
(*const_cast<T*>(&c_)) = new_c;
}
- inline expression_node<T>* branch(const std::size_t&) const
+ inline expression_node<T>* branch(const std::size_t&) const exprtk_override
{
return branch_.first;
}
- inline expression_node<T>* move_branch(const std::size_t&)
+ inline expression_node<T>* move_branch(const std::size_t&) exprtk_override
{
branch_.second = false;
return branch_.first;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::template collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
private:
- boc_node(const boc_node<T,Operation>&);
- boc_node<T,Operation>& operator=(const boc_node<T,Operation>&);
+ boc_node(const boc_node<T,Operation>&) exprtk_delete;
+ boc_node<T,Operation>& operator=(const boc_node<T,Operation>&) exprtk_delete;
const T c_;
branch_t branch_;
@@ -15501,7 +15845,7 @@
#ifndef exprtk_disable_string_capabilities
template <typename T, typename SType0, typename SType1, typename Operation>
- class sos_node : public sos_base_node<T>
+ class sos_node exprtk_final : public sos_base_node<T>
{
public:
@@ -15510,21 +15854,21 @@
// string op string node
explicit sos_node(SType0 p0, SType1 p1)
- : s0_(p0),
- s1_(p1)
+ : s0_(p0)
+ , s1_(p1)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return Operation::process(s0_,s1_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return Operation::type();
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return Operation::operation();
}
@@ -15546,23 +15890,24 @@
private:
- sos_node(sos_node<T,SType0,SType1,Operation>&);
- sos_node<T,SType0,SType1,Operation>& operator=(sos_node<T,SType0,SType1,Operation>&);
+ sos_node(const sos_node<T,SType0,SType1,Operation>&) exprtk_delete;
+ sos_node<T,SType0,SType1,Operation>& operator=(const sos_node<T,SType0,SType1,Operation>&) exprtk_delete;
};
template <typename T, typename SType0, typename SType1, typename RangePack, typename Operation>
- class str_xrox_node : public sos_base_node<T>
+ class str_xrox_node exprtk_final : public sos_base_node<T>
{
public:
typedef expression_node<T>* expression_ptr;
typedef Operation operation_t;
+ typedef str_xrox_node<T,SType0,SType1,RangePack,Operation> node_type;
// string-range op string node
explicit str_xrox_node(SType0 p0, SType1 p1, RangePack rp0)
- : s0_ (p0 ),
- s1_ (p1 ),
- rp0_(rp0)
+ : s0_ (p0 )
+ , s1_ (p1 )
+ , rp0_(rp0)
{}
~str_xrox_node()
@@ -15570,7 +15915,7 @@
rp0_.free();
}
- inline T value() const
+ inline T value() const exprtk_override
{
std::size_t r0 = 0;
std::size_t r1 = 0;
@@ -15581,12 +15926,12 @@
return T(0);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return Operation::type();
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return Operation::operation();
}
@@ -15609,23 +15954,24 @@
private:
- str_xrox_node(str_xrox_node<T,SType0,SType1,RangePack,Operation>&);
- str_xrox_node<T,SType0,SType1,RangePack,Operation>& operator=(str_xrox_node<T,SType0,SType1,RangePack,Operation>&);
+ str_xrox_node(const node_type&) exprtk_delete;
+ node_type& operator=(const node_type&) exprtk_delete;
};
template <typename T, typename SType0, typename SType1, typename RangePack, typename Operation>
- class str_xoxr_node : public sos_base_node<T>
+ class str_xoxr_node exprtk_final : public sos_base_node<T>
{
public:
typedef expression_node<T>* expression_ptr;
typedef Operation operation_t;
+ typedef str_xoxr_node<T,SType0,SType1,RangePack,Operation> node_type;
// string op string range node
explicit str_xoxr_node(SType0 p0, SType1 p1, RangePack rp1)
- : s0_ (p0 ),
- s1_ (p1 ),
- rp1_(rp1)
+ : s0_ (p0 )
+ , s1_ (p1 )
+ , rp1_(rp1)
{}
~str_xoxr_node()
@@ -15633,7 +15979,7 @@
rp1_.free();
}
- inline T value() const
+ inline T value() const exprtk_override
{
std::size_t r0 = 0;
std::size_t r1 = 0;
@@ -15644,12 +15990,12 @@
return T(0);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return Operation::type();
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return Operation::operation();
}
@@ -15672,24 +16018,25 @@
private:
- str_xoxr_node(str_xoxr_node<T,SType0,SType1,RangePack,Operation>&);
- str_xoxr_node<T,SType0,SType1,RangePack,Operation>& operator=(str_xoxr_node<T,SType0,SType1,RangePack,Operation>&);
+ str_xoxr_node(const node_type&) exprtk_delete;
+ node_type& operator=(const node_type&) exprtk_delete;
};
template <typename T, typename SType0, typename SType1, typename RangePack, typename Operation>
- class str_xroxr_node : public sos_base_node<T>
+ class str_xroxr_node exprtk_final : public sos_base_node<T>
{
public:
typedef expression_node<T>* expression_ptr;
typedef Operation operation_t;
+ typedef str_xroxr_node<T,SType0,SType1,RangePack,Operation> node_type;
// string-range op string-range node
explicit str_xroxr_node(SType0 p0, SType1 p1, RangePack rp0, RangePack rp1)
- : s0_ (p0 ),
- s1_ (p1 ),
- rp0_(rp0),
- rp1_(rp1)
+ : s0_ (p0 )
+ , s1_ (p1 )
+ , rp0_(rp0)
+ , rp1_(rp1)
{}
~str_xroxr_node()
@@ -15698,7 +16045,7 @@
rp1_.free();
}
- inline T value() const
+ inline T value() const exprtk_override
{
std::size_t r0_0 = 0;
std::size_t r0_1 = 0;
@@ -15719,12 +16066,12 @@
return T(0);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return Operation::type();
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return Operation::operation();
}
@@ -15748,30 +16095,30 @@
private:
- str_xroxr_node(str_xroxr_node<T,SType0,SType1,RangePack,Operation>&);
- str_xroxr_node<T,SType0,SType1,RangePack,Operation>& operator=(str_xroxr_node<T,SType0,SType1,RangePack,Operation>&);
+ str_xroxr_node(const node_type&) exprtk_delete;
+ node_type& operator=(const node_type&) exprtk_delete;
};
template <typename T, typename Operation>
- class str_sogens_node : public binary_node<T>
+ class str_sogens_node exprtk_final : public binary_node<T>
{
public:
typedef expression_node <T>* expression_ptr;
- typedef string_base_node<T>* str_base_ptr;
- typedef range_pack <T> range_t;
- typedef range_t* range_ptr;
- typedef range_interface<T> irange_t;
- typedef irange_t* irange_ptr;
+ typedef string_base_node<T>* str_base_ptr;
+ typedef range_pack <T> range_t;
+ typedef range_t* range_ptr;
+ typedef range_interface <T> irange_t;
+ typedef irange_t* irange_ptr;
str_sogens_node(const operator_type& opr,
expression_ptr branch0,
expression_ptr branch1)
- : binary_node<T>(opr, branch0, branch1),
- str0_base_ptr_ (0),
- str1_base_ptr_ (0),
- str0_range_ptr_(0),
- str1_range_ptr_(0)
+ : binary_node<T>(opr, branch0, branch1)
+ , str0_base_ptr_ (0)
+ , str1_base_ptr_ (0)
+ , str0_range_ptr_(0)
+ , str1_range_ptr_(0)
{
if (is_generally_string_node(binary_node<T>::branch_[0].first))
{
@@ -15804,7 +16151,7 @@
}
}
- inline T value() const
+ inline T value() const exprtk_override
{
if (
str0_base_ptr_ &&
@@ -15840,20 +16187,15 @@
return std::numeric_limits<T>::quiet_NaN();
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return Operation::type();
}
- inline operator_type operation() const
- {
- return Operation::operation();
- }
-
private:
- str_sogens_node(str_sogens_node<T,Operation>&);
- str_sogens_node<T,Operation>& operator=(str_sogens_node<T,Operation>&);
+ str_sogens_node(const str_sogens_node<T,Operation>&) exprtk_delete;
+ str_sogens_node<T,Operation>& operator=(const str_sogens_node<T,Operation>&) exprtk_delete;
str_base_ptr str0_base_ptr_;
str_base_ptr str1_base_ptr_;
@@ -15862,31 +16204,32 @@
};
template <typename T, typename SType0, typename SType1, typename SType2, typename Operation>
- class sosos_node : public sosos_base_node<T>
+ class sosos_node exprtk_final : public sosos_base_node<T>
{
public:
typedef expression_node<T>* expression_ptr;
typedef Operation operation_t;
+ typedef sosos_node<T, SType0, SType1, SType2, Operation> node_type;
// variable op variable node
explicit sosos_node(SType0 p0, SType1 p1, SType2 p2)
- : s0_(p0),
- s1_(p1),
- s2_(p2)
+ : s0_(p0)
+ , s1_(p1)
+ , s2_(p2)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
- return Operation::process(s0_,s1_,s2_);
+ return Operation::process(s0_, s1_, s2_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return Operation::type();
}
- inline operator_type operation() const
+ inline operator_type operation() const exprtk_override
{
return Operation::operation();
}
@@ -15914,13 +16257,13 @@
private:
- sosos_node(sosos_node<T,SType0,SType1,SType2,Operation>&);
- sosos_node<T,SType0,SType1,SType2,Operation>& operator=(sosos_node<T,SType0,SType1,SType2,Operation>&);
+ sosos_node(const node_type&) exprtk_delete;
+ node_type& operator=(const node_type&) exprtk_delete;
};
#endif
template <typename T, typename PowOp>
- class ipow_node : public expression_node<T>
+ class ipow_node exprtk_final: public expression_node<T>
{
public:
@@ -15931,26 +16274,26 @@
: v_(v)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return PowOp::result(v_);
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_ipow;
}
private:
- ipow_node(const ipow_node<T,PowOp>&);
- ipow_node<T,PowOp>& operator=(const ipow_node<T,PowOp>&);
+ ipow_node(const ipow_node<T,PowOp>&) exprtk_delete;
+ ipow_node<T,PowOp>& operator=(const ipow_node<T,PowOp>&) exprtk_delete;
const T& v_;
};
template <typename T, typename PowOp>
- class bipow_node : public expression_node<T>
+ class bipow_node exprtk_final : public expression_node<T>
{
public:
@@ -15963,37 +16306,37 @@
construct_branch_pair(branch_, branch);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(branch_.first);
return PowOp::result(branch_.first->value());
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_ipow;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
private:
- bipow_node(const bipow_node<T,PowOp>&);
- bipow_node<T,PowOp>& operator=(const bipow_node<T,PowOp>&);
+ bipow_node(const bipow_node<T,PowOp>&) exprtk_delete;
+ bipow_node<T,PowOp>& operator=(const bipow_node<T,PowOp>&) exprtk_delete;
branch_t branch_;
};
template <typename T, typename PowOp>
- class ipowinv_node : public expression_node<T>
+ class ipowinv_node exprtk_final : public expression_node<T>
{
public:
@@ -16004,26 +16347,26 @@
: v_(v)
{}
- inline T value() const
+ inline T value() const exprtk_override
{
return (T(1) / PowOp::result(v_));
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_ipowinv;
}
private:
- ipowinv_node(const ipowinv_node<T,PowOp>&);
- ipowinv_node<T,PowOp>& operator=(const ipowinv_node<T,PowOp>&);
+ ipowinv_node(const ipowinv_node<T,PowOp>&) exprtk_delete;
+ ipowinv_node<T,PowOp>& operator=(const ipowinv_node<T,PowOp>&) exprtk_delete;
const T& v_;
};
template <typename T, typename PowOp>
- class bipowninv_node : public expression_node<T>
+ class bipowninv_node exprtk_final : public expression_node<T>
{
public:
@@ -16036,31 +16379,31 @@
construct_branch_pair(branch_, branch);
}
- inline T value() const
+ inline T value() const exprtk_override
{
assert(branch_.first);
return (T(1) / PowOp::result(branch_.first->value()));
}
- inline typename expression_node<T>::node_type type() const
+ inline typename expression_node<T>::node_type type() const exprtk_override
{
return expression_node<T>::e_ipowinv;
}
- void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list)
+ void collect_nodes(typename expression_node<T>::noderef_list_t& node_delete_list) exprtk_override
{
expression_node<T>::ndb_t::template collect(branch_, node_delete_list);
}
- std::size_t node_depth() const
+ std::size_t node_depth() const exprtk_override
{
return expression_node<T>::ndb_t::compute_node_depth(branch_);
}
private:
- bipowninv_node(const bipowninv_node<T,PowOp>&);
- bipowninv_node<T,PowOp>& operator=(const bipowninv_node<T,PowOp>&);
+ bipowninv_node(const bipowninv_node<T,PowOp>&) exprtk_delete;
+ bipowninv_node<T,PowOp>& operator=(const bipowninv_node<T,PowOp>&) exprtk_delete;
branch_t branch_;
};
@@ -16592,61 +16935,61 @@
inline void load_operations_map(std::multimap<std::string,details::base_operation_t,details::ilesscompare>& m)
{
- #define register_op(Symbol,Type,Args) \
+ #define register_op(Symbol, Type, Args) \
m.insert(std::make_pair(std::string(Symbol),details::base_operation_t(Type,Args))); \
- register_op( "abs", e_abs , 1)
- register_op( "acos", e_acos , 1)
- register_op( "acosh", e_acosh , 1)
- register_op( "asin", e_asin , 1)
- register_op( "asinh", e_asinh , 1)
- register_op( "atan", e_atan , 1)
- register_op( "atanh", e_atanh , 1)
- register_op( "ceil", e_ceil , 1)
- register_op( "cos", e_cos , 1)
- register_op( "cosh", e_cosh , 1)
- register_op( "exp", e_exp , 1)
- register_op( "expm1", e_expm1 , 1)
- register_op( "floor", e_floor , 1)
- register_op( "log", e_log , 1)
- register_op( "log10", e_log10 , 1)
- register_op( "log2", e_log2 , 1)
- register_op( "log1p", e_log1p , 1)
- register_op( "round", e_round , 1)
- register_op( "sin", e_sin , 1)
- register_op( "sinc", e_sinc , 1)
- register_op( "sinh", e_sinh , 1)
- register_op( "sec", e_sec , 1)
- register_op( "csc", e_csc , 1)
- register_op( "sqrt", e_sqrt , 1)
- register_op( "tan", e_tan , 1)
- register_op( "tanh", e_tanh , 1)
- register_op( "cot", e_cot , 1)
- register_op( "rad2deg", e_r2d , 1)
- register_op( "deg2rad", e_d2r , 1)
- register_op( "deg2grad", e_d2g , 1)
- register_op( "grad2deg", e_g2d , 1)
- register_op( "sgn", e_sgn , 1)
- register_op( "not", e_notl , 1)
- register_op( "erf", e_erf , 1)
- register_op( "erfc", e_erfc , 1)
- register_op( "ncdf", e_ncdf , 1)
- register_op( "frac", e_frac , 1)
- register_op( "trunc", e_trunc , 1)
- register_op( "atan2", e_atan2 , 2)
- register_op( "mod", e_mod , 2)
- register_op( "logn", e_logn , 2)
- register_op( "pow", e_pow , 2)
- register_op( "root", e_root , 2)
- register_op( "roundn", e_roundn , 2)
- register_op( "equal", e_equal , 2)
- register_op("not_equal", e_nequal , 2)
- register_op( "hypot", e_hypot , 2)
- register_op( "shr", e_shr , 2)
- register_op( "shl", e_shl , 2)
- register_op( "clamp", e_clamp , 3)
- register_op( "iclamp", e_iclamp , 3)
- register_op( "inrange", e_inrange , 3)
+ register_op("abs" , e_abs , 1)
+ register_op("acos" , e_acos , 1)
+ register_op("acosh" , e_acosh , 1)
+ register_op("asin" , e_asin , 1)
+ register_op("asinh" , e_asinh , 1)
+ register_op("atan" , e_atan , 1)
+ register_op("atanh" , e_atanh , 1)
+ register_op("ceil" , e_ceil , 1)
+ register_op("cos" , e_cos , 1)
+ register_op("cosh" , e_cosh , 1)
+ register_op("exp" , e_exp , 1)
+ register_op("expm1" , e_expm1 , 1)
+ register_op("floor" , e_floor , 1)
+ register_op("log" , e_log , 1)
+ register_op("log10" , e_log10 , 1)
+ register_op("log2" , e_log2 , 1)
+ register_op("log1p" , e_log1p , 1)
+ register_op("round" , e_round , 1)
+ register_op("sin" , e_sin , 1)
+ register_op("sinc" , e_sinc , 1)
+ register_op("sinh" , e_sinh , 1)
+ register_op("sec" , e_sec , 1)
+ register_op("csc" , e_csc , 1)
+ register_op("sqrt" , e_sqrt , 1)
+ register_op("tan" , e_tan , 1)
+ register_op("tanh" , e_tanh , 1)
+ register_op("cot" , e_cot , 1)
+ register_op("rad2deg" , e_r2d , 1)
+ register_op("deg2rad" , e_d2r , 1)
+ register_op("deg2grad" , e_d2g , 1)
+ register_op("grad2deg" , e_g2d , 1)
+ register_op("sgn" , e_sgn , 1)
+ register_op("not" , e_notl , 1)
+ register_op("erf" , e_erf , 1)
+ register_op("erfc" , e_erfc , 1)
+ register_op("ncdf" , e_ncdf , 1)
+ register_op("frac" , e_frac , 1)
+ register_op("trunc" , e_trunc , 1)
+ register_op("atan2" , e_atan2 , 2)
+ register_op("mod" , e_mod , 2)
+ register_op("logn" , e_logn , 2)
+ register_op("pow" , e_pow , 2)
+ register_op("root" , e_root , 2)
+ register_op("roundn" , e_roundn , 2)
+ register_op("equal" , e_equal , 2)
+ register_op("not_equal" , e_nequal , 2)
+ register_op("hypot" , e_hypot , 2)
+ register_op("shr" , e_shr , 2)
+ register_op("shl" , e_shl , 2)
+ register_op("clamp" , e_clamp , 3)
+ register_op("iclamp" , e_iclamp , 3)
+ register_op("inrange" , e_inrange , 3)
#undef register_op
}
@@ -16657,10 +17000,10 @@
public:
function_traits()
- : allow_zero_parameters_(false),
- has_side_effects_(true),
- min_num_args_(0),
- max_num_args_(std::numeric_limits<std::size_t>::max())
+ : allow_zero_parameters_(false)
+ , has_side_effects_(true)
+ , min_num_args_(0)
+ , max_num_args_(std::numeric_limits<std::size_t>::max())
{}
inline bool& allow_zero_parameters()
@@ -16744,8 +17087,7 @@
: param_count(pc)
{}
- virtual ~ifunction()
- {}
+ virtual ~ifunction() {}
#define empty_method_body(N) \
{ \
@@ -16836,8 +17178,7 @@
{
public:
- virtual ~ivararg_function()
- {}
+ virtual ~ivararg_function() {}
inline virtual T operator() (const std::vector<T>&)
{
@@ -16863,12 +17204,11 @@
typedef typename generic_type::parameter_list parameter_list_t;
igeneric_function(const std::string& param_seq = "", const return_type rtr_type = e_rtrn_scalar)
- : parameter_sequence(param_seq),
- rtrn_type(rtr_type)
+ : parameter_sequence(param_seq)
+ , rtrn_type(rtr_type)
{}
- virtual ~igeneric_function()
- {}
+ virtual ~igeneric_function() {}
#define igeneric_function_empty_body(N) \
{ \
@@ -16896,6 +17236,43 @@
return_type rtrn_type;
};
+ #ifndef exprtk_disable_string_capabilities
+ template <typename T>
+ class stringvar_base
+ {
+ public:
+
+ typedef typename details::stringvar_node<T> stringvar_node_t;
+
+ stringvar_base(const std::string& name, stringvar_node_t* svn)
+ : name_(name)
+ , string_varnode_(svn)
+ {}
+
+ bool valid() const
+ {
+ return !name_.empty() && (0 != string_varnode_);
+ }
+
+ std::string name() const
+ {
+ assert(string_varnode_);
+ return name_;
+ }
+
+ void rebase(std::string& s)
+ {
+ assert(string_varnode_);
+ string_varnode_->rebase(s);
+ }
+
+ private:
+
+ std::string name_;
+ stringvar_node_t* string_varnode_;
+ };
+ #endif
+
template <typename T> class parser;
template <typename T> class expression_helper;
@@ -17125,6 +17502,27 @@
: size(0)
{}
+ struct deleter
+ {
+ #define exprtk_define_process(Type) \
+ static inline void process(std::pair<bool,Type*>& n) \
+ { \
+ delete n.second; \
+ } \
+
+ exprtk_define_process(variable_node_t )
+ exprtk_define_process(vector_t )
+ #ifndef exprtk_disable_string_capabilities
+ exprtk_define_process(stringvar_node_t)
+ #endif
+
+ #undef exprtk_define_process
+
+ template <typename DeleteType>
+ static inline void process(std::pair<bool,DeleteType*>&)
+ {}
+ };
+
inline bool symbol_exists(const std::string& symbol_name) const
{
if (symbol_name.empty())
@@ -17263,19 +17661,19 @@
(symbol_name, v, is_const);
}
- inline bool add(const std::string& symbol_name, RawType& t, const bool is_const = false)
+ inline bool add(const std::string& symbol_name, RawType& t_, const bool is_const = false)
{
struct tie
{
- static inline std::pair<bool,variable_node_t*> make(T& t,const bool is_const = false)
+ static inline std::pair<bool,variable_node_t*> make(T& t, const bool is_constant = false)
{
- return std::make_pair(is_const, new variable_node_t(t));
+ return std::make_pair(is_constant, new variable_node_t(t));
}
#ifndef exprtk_disable_string_capabilities
- static inline std::pair<bool,stringvar_node_t*> make(std::string& t,const bool is_const = false)
+ static inline std::pair<bool,stringvar_node_t*> make(std::string& t, const bool is_constant = false)
{
- return std::make_pair(is_const, new stringvar_node_t(t));
+ return std::make_pair(is_constant, new stringvar_node_t(t));
}
#endif
@@ -17284,9 +17682,9 @@
return std::make_pair(is_constant,&t);
}
- static inline std::pair<bool,vararg_function_t*> make(vararg_function_t& t, const bool is_const = false)
+ static inline std::pair<bool,vararg_function_t*> make(vararg_function_t& t, const bool is_constant = false)
{
- return std::make_pair(is_const,&t);
+ return std::make_pair(is_constant,&t);
}
static inline std::pair<bool,generic_function_t*> make(generic_function_t& t, const bool is_constant = false)
@@ -17299,7 +17697,7 @@
if (map.end() == itr)
{
- map[symbol_name] = tie::make(t,is_const);
+ map[symbol_name] = tie::make(t_,is_const);
++size;
}
@@ -17360,16 +17758,6 @@
if (map.end() != itr)
{
- struct deleter
- {
- static inline void process(std::pair<bool,variable_node_t*>& n) { delete n.second; }
- static inline void process(std::pair<bool,vector_t*>& n) { delete n.second; }
- #ifndef exprtk_disable_string_capabilities
- static inline void process(std::pair<bool,stringvar_node_t*>& n) { delete n.second; }
- #endif
- static inline void process(std::pair<bool,function_t*>&) { }
- };
-
if (delete_node)
{
deleter::process((*itr).second);
@@ -17406,16 +17794,6 @@
inline void clear(const bool delete_node = true)
{
- struct deleter
- {
- static inline void process(std::pair<bool,variable_node_t*>& n) { delete n.second; }
- static inline void process(std::pair<bool,vector_t*>& n) { delete n.second; }
- static inline void process(std::pair<bool,function_t*>&) { }
- #ifndef exprtk_disable_string_capabilities
- static inline void process(std::pair<bool,stringvar_node_t*>& n) { delete n.second; }
- #endif
- };
-
if (!map.empty())
{
if (delete_node)
@@ -17481,20 +17859,20 @@
}
};
- typedef details::expression_node<T>* expression_ptr;
- typedef typename details::variable_node<T> variable_t;
- typedef typename details::vector_holder<T> vector_holder_t;
- typedef variable_t* variable_ptr;
+ typedef details::expression_node<T>* expression_ptr;
+ typedef typename details::variable_node<T> variable_t;
+ typedef typename details::vector_holder<T> vector_holder_t;
+ typedef variable_t* variable_ptr;
#ifndef exprtk_disable_string_capabilities
typedef typename details::stringvar_node<T> stringvar_t;
- typedef stringvar_t* stringvar_ptr;
+ typedef stringvar_t* stringvar_ptr;
#endif
- typedef ifunction <T> function_t;
- typedef ivararg_function <T> vararg_function_t;
- typedef igeneric_function<T> generic_function_t;
- typedef function_t* function_ptr;
- typedef vararg_function_t* vararg_function_ptr;
- typedef generic_function_t* generic_function_ptr;
+ typedef ifunction <T> function_t;
+ typedef ivararg_function <T> vararg_function_t;
+ typedef igeneric_function<T> generic_function_t;
+ typedef function_t* function_ptr;
+ typedef vararg_function_t* vararg_function_ptr;
+ typedef generic_function_t* generic_function_ptr;
static const std::size_t lut_size = 256;
@@ -17503,16 +17881,16 @@
{
struct st_data
{
- type_store<typename details::variable_node<T>,T> variable_store;
+ type_store<variable_t , T > variable_store;
+ type_store<function_t , function_t > function_store;
+ type_store<vararg_function_t , vararg_function_t > vararg_function_store;
+ type_store<generic_function_t, generic_function_t> generic_function_store;
+ type_store<generic_function_t, generic_function_t> string_function_store;
+ type_store<generic_function_t, generic_function_t> overload_function_store;
+ type_store<vector_holder_t , vector_holder_t > vector_store;
#ifndef exprtk_disable_string_capabilities
- type_store<typename details::stringvar_node<T>,std::string> stringvar_store;
+ type_store<stringvar_t , std::string > stringvar_store;
#endif
- type_store<ifunction<T>,ifunction<T> > function_store;
- type_store<ivararg_function <T>,ivararg_function <T> > vararg_function_store;
- type_store<igeneric_function<T>,igeneric_function<T> > generic_function_store;
- type_store<igeneric_function<T>,igeneric_function<T> > string_function_store;
- type_store<igeneric_function<T>,igeneric_function<T> > overload_function_store;
- type_store<vector_holder_t,vector_holder_t> vector_store;
st_data()
{
@@ -17558,13 +17936,13 @@
};
control_block()
- : ref_count(1),
- data_(st_data::create())
+ : ref_count(1)
+ , data_(st_data::create())
{}
explicit control_block(st_data* data)
- : ref_count(1),
- data_(data)
+ : ref_count(1)
+ , data_(data)
{}
~control_block()
@@ -17741,6 +18119,24 @@
else
return local_data().stringvar_store.get(string_name);
}
+
+ inline stringvar_base<T> get_stringvar_base(const std::string& string_name) const
+ {
+ static stringvar_base<T> null_stringvar_base("",reinterpret_cast<stringvar_ptr>(0));
+ if (!valid())
+ return null_stringvar_base;
+ else if (!valid_symbol(string_name))
+ return null_stringvar_base;
+
+ stringvar_ptr stringvar = local_data().stringvar_store.get(string_name);
+
+ if (0 == stringvar)
+ {
+ return null_stringvar_base;
+ }
+
+ return stringvar_base<T>(string_name,stringvar);
+ }
#endif
inline function_ptr get_function(const std::string& function_name) const
@@ -17958,30 +18354,22 @@
return false;
else if (symbol_exists(function_name))
return false;
- else if (
- (
- (generic_function_t::e_rtrn_scalar == function.rtrn_type) ||
- (generic_function_t::e_rtrn_string == function.rtrn_type)
- ) &&
- std::string::npos != function.parameter_sequence.find_first_not_of("STVZ*?|")
- )
- return false;
- else if (
- (generic_function_t::e_rtrn_overload == function.rtrn_type) &&
- std::string::npos != function.parameter_sequence.find_first_not_of("STVZ*?|:")
- )
- return false;
-
- switch (function.rtrn_type)
+ else
{
- case generic_function_t::e_rtrn_scalar :
- return local_data().generic_function_store.add(function_name,function);
+ switch (function.rtrn_type)
+ {
+ case generic_function_t::e_rtrn_scalar :
+ return (std::string::npos == function.parameter_sequence.find_first_not_of("STVZ*?|")) ?
+ local_data().generic_function_store.add(function_name,function) : false;
- case generic_function_t::e_rtrn_string :
- return local_data().string_function_store.add(function_name,function);
+ case generic_function_t::e_rtrn_string :
+ return (std::string::npos == function.parameter_sequence.find_first_not_of("STVZ*?|")) ?
+ local_data().string_function_store.add(function_name,function) : false;
- case generic_function_t::e_rtrn_overload :
- return local_data().overload_function_store.add(function_name,function);
+ case generic_function_t::e_rtrn_overload :
+ return (std::string::npos == function.parameter_sequence.find_first_not_of("STVZ*?|:")) ?
+ local_data().overload_function_store.add(function_name,function) : false;
+ }
}
return false;
@@ -18047,30 +18435,22 @@
return false;
else if (symbol_exists(function_name,false))
return false;
- else if (
- (
- (generic_function_t::e_rtrn_scalar == function.rtrn_type) ||
- (generic_function_t::e_rtrn_string == function.rtrn_type)
- ) &&
- std::string::npos != function.parameter_sequence.find_first_not_of("STV*?|")
- )
- return false;
- else if (
- generic_function_t::e_rtrn_overload &&
- std::string::npos != function.parameter_sequence.find_first_not_of("STV*?|:")
- )
- return false;
-
- switch (function.rtrn_type)
+ else
{
- case generic_function_t::e_rtrn_scalar :
- return local_data().generic_function_store.add(function_name,function);
+ switch (function.rtrn_type)
+ {
+ case generic_function_t::e_rtrn_scalar :
+ return (std::string::npos == function.parameter_sequence.find_first_not_of("STVZ*?|")) ?
+ local_data().generic_function_store.add(function_name,function) : false;
- case generic_function_t::e_rtrn_string :
- return local_data().string_function_store.add(function_name,function);
+ case generic_function_t::e_rtrn_string :
+ return (std::string::npos == function.parameter_sequence.find_first_not_of("STVZ*?|")) ?
+ local_data().string_function_store.add(function_name,function) : false;
- case generic_function_t::e_rtrn_overload :
- return local_data().overload_function_store.add(function_name,function);
+ case generic_function_t::e_rtrn_overload :
+ return (std::string::npos == function.parameter_sequence.find_first_not_of("STVZ*?|:")) ?
+ local_data().overload_function_store.add(function_name,function) : false;
+ }
}
return false;
@@ -18515,7 +18895,7 @@
control_block* control_block_;
friend class parser<T>;
- };
+ }; // class symbol_table
template <typename T>
class function_compositor;
@@ -18526,8 +18906,8 @@
private:
typedef details::expression_node<T>* expression_ptr;
- typedef details::vector_holder<T>* vector_holder_ptr;
- typedef std::vector<symbol_table<T> > symtab_list_t;
+ typedef details::vector_holder<T>* vector_holder_ptr;
+ typedef std::vector<symbol_table<T> > symtab_list_t;
struct control_block
{
@@ -18544,15 +18924,15 @@
struct data_pack
{
data_pack()
- : pointer(0),
- type(e_unknown),
- size(0)
+ : pointer(0)
+ , type(e_unknown)
+ , size(0)
{}
data_pack(void* ptr, const data_type dt, const std::size_t sz = 0)
- : pointer(ptr),
- type(dt),
- size(sz)
+ : pointer(ptr)
+ , type(dt)
+ , size(sz)
{}
void* pointer;
@@ -18562,21 +18942,22 @@
typedef std::vector<data_pack> local_data_list_t;
typedef results_context<T> results_context_t;
+ typedef control_block* cntrl_blck_ptr_t;
control_block()
- : ref_count(0),
- expr (0),
- results (0),
- retinv_null(false),
- return_invoked(&retinv_null)
+ : ref_count(0)
+ , expr (0)
+ , results (0)
+ , retinv_null(false)
+ , return_invoked(&retinv_null)
{}
explicit control_block(expression_ptr e)
- : ref_count(1),
- expr (e),
- results (0),
- retinv_null(false),
- return_invoked(&retinv_null)
+ : ref_count(1)
+ , expr (e)
+ , results (0)
+ , retinv_null(false)
+ , return_invoked(&retinv_null)
{}
~control_block()
@@ -18598,13 +18979,13 @@
case e_vecholder : delete reinterpret_cast<vector_holder_ptr>(local_data_list[i].pointer);
break;
- case e_data : delete (T*)(local_data_list[i].pointer);
+ case e_data : delete reinterpret_cast<T*>(local_data_list[i].pointer);
break;
- case e_vecdata : delete [] (T*)(local_data_list[i].pointer);
+ case e_vecdata : delete [] reinterpret_cast<T*>(local_data_list[i].pointer);
break;
- case e_string : delete (std::string*)(local_data_list[i].pointer);
+ case e_string : delete reinterpret_cast<std::string*>(local_data_list[i].pointer);
break;
default : break;
@@ -18618,12 +18999,12 @@
}
}
- static inline control_block* create(expression_ptr e)
+ static inline cntrl_blck_ptr_t create(expression_ptr e)
{
return new control_block(e);
}
- static inline void destroy(control_block*& cntrl_blck)
+ static inline void destroy(cntrl_blck_ptr_t& cntrl_blck)
{
if (cntrl_blck)
{
@@ -18658,8 +19039,8 @@
}
expression(const expression<T>& e)
- : control_block_ (e.control_block_ ),
- symbol_table_list_(e.symbol_table_list_)
+ : control_block_ (e.control_block_ )
+ , symbol_table_list_(e.symbol_table_list_)
{
control_block_->ref_count++;
}
@@ -18888,7 +19269,7 @@
friend class parser<T>;
friend class expression_helper<T>;
friend class function_compositor<T>;
- };
+ }; // class expression
template <typename T>
class expression_helper
@@ -18949,9 +19330,9 @@
struct type
{
type()
- : mode(parser_error::e_unknown),
- line_no (0),
- column_no(0)
+ : mode(parser_error::e_unknown)
+ , line_no (0)
+ , column_no(0)
{}
lexer::token token;
@@ -18982,9 +19363,9 @@
const std::string& src_location = "")
{
type t;
- t.mode = mode;
- t.token = tk;
- t.diagnostic = diagnostic;
+ t.mode = mode;
+ t.token = tk;
+ t.diagnostic = diagnostic;
t.src_location = src_location;
exprtk_debug(("%s\n",diagnostic .c_str()));
return t;
@@ -19073,92 +19454,87 @@
enum precedence_level
{
- e_level00,
- e_level01,
- e_level02,
- e_level03,
- e_level04,
- e_level05,
- e_level06,
- e_level07,
- e_level08,
- e_level09,
- e_level10,
- e_level11,
- e_level12,
- e_level13,
- e_level14
+ e_level00, e_level01, e_level02, e_level03, e_level04,
+ e_level05, e_level06, e_level07, e_level08, e_level09,
+ e_level10, e_level11, e_level12, e_level13, e_level14
};
- typedef const T& cref_t;
- typedef const T const_t;
- typedef ifunction <T> F;
- typedef ivararg_function <T> VAF;
- typedef igeneric_function <T> GF;
- typedef ifunction <T> ifunction_t;
- typedef ivararg_function <T> ivararg_function_t;
- typedef igeneric_function <T> igeneric_function_t;
- typedef details::expression_node <T> expression_node_t;
- typedef details::literal_node <T> literal_node_t;
- typedef details::unary_node <T> unary_node_t;
- typedef details::binary_node <T> binary_node_t;
- typedef details::trinary_node <T> trinary_node_t;
- typedef details::quaternary_node <T> quaternary_node_t;
- typedef details::conditional_node<T> conditional_node_t;
- typedef details::cons_conditional_node<T> cons_conditional_node_t;
- typedef details::while_loop_node <T> while_loop_node_t;
- typedef details::repeat_until_loop_node<T> repeat_until_loop_node_t;
- typedef details::for_loop_node <T> for_loop_node_t;
+ typedef const T& cref_t;
+ typedef const T const_t;
+ typedef ifunction<T> F;
+ typedef ivararg_function<T> VAF;
+ typedef igeneric_function<T> GF;
+ typedef ifunction<T> ifunction_t;
+ typedef ivararg_function<T> ivararg_function_t;
+ typedef igeneric_function<T> igeneric_function_t;
+ typedef details::expression_node<T> expression_node_t;
+ typedef details::literal_node<T> literal_node_t;
+ typedef details::unary_node<T> unary_node_t;
+ typedef details::binary_node<T> binary_node_t;
+ typedef details::trinary_node<T> trinary_node_t;
+ typedef details::quaternary_node<T> quaternary_node_t;
+ typedef details::conditional_node<T> conditional_node_t;
+ typedef details::cons_conditional_node<T> cons_conditional_node_t;
+ typedef details::while_loop_node<T> while_loop_node_t;
+ typedef details::repeat_until_loop_node<T> repeat_until_loop_node_t;
+ typedef details::for_loop_node<T> for_loop_node_t;
+ typedef details::while_loop_rtc_node<T> while_loop_rtc_node_t;
+ typedef details::repeat_until_loop_rtc_node<T> repeat_until_loop_rtc_node_t;
+ typedef details::for_loop_rtc_node<T> for_loop_rtc_node_t;
#ifndef exprtk_disable_break_continue
- typedef details::while_loop_bc_node <T> while_loop_bc_node_t;
- typedef details::repeat_until_loop_bc_node<T> repeat_until_loop_bc_node_t;
- typedef details::for_loop_bc_node<T> for_loop_bc_node_t;
+ typedef details::while_loop_bc_node<T> while_loop_bc_node_t;
+ typedef details::repeat_until_loop_bc_node<T> repeat_until_loop_bc_node_t;
+ typedef details::for_loop_bc_node<T> for_loop_bc_node_t;
+ typedef details::while_loop_bc_rtc_node<T> while_loop_bc_rtc_node_t;
+ typedef details::repeat_until_loop_bc_rtc_node<T> repeat_until_loop_bc_rtc_node_t;
+ typedef details::for_loop_bc_rtc_node<T> for_loop_bc_rtc_node_t;
#endif
- typedef details::switch_node <T> switch_node_t;
- typedef details::variable_node <T> variable_node_t;
- typedef details::vector_elem_node<T> vector_elem_node_t;
- typedef details::rebasevector_elem_node<T> rebasevector_elem_node_t;
- typedef details::rebasevector_celem_node<T> rebasevector_celem_node_t;
- typedef details::vector_node <T> vector_node_t;
- typedef details::range_pack <T> range_t;
+ typedef details::switch_node<T> switch_node_t;
+ typedef details::variable_node<T> variable_node_t;
+ typedef details::vector_elem_node<T> vector_elem_node_t;
+ typedef details::rebasevector_elem_node<T> rebasevector_elem_node_t;
+ typedef details::rebasevector_celem_node<T> rebasevector_celem_node_t;
+ typedef details::vector_node<T> vector_node_t;
+ typedef details::range_pack<T> range_t;
#ifndef exprtk_disable_string_capabilities
- typedef details::stringvar_node <T> stringvar_node_t;
- typedef details::string_literal_node<T> string_literal_node_t;
- typedef details::string_range_node <T> string_range_node_t;
- typedef details::const_string_range_node<T> const_string_range_node_t;
- typedef details::generic_string_range_node<T> generic_string_range_node_t;
- typedef details::string_concat_node <T> string_concat_node_t;
- typedef details::assignment_string_node<T> assignment_string_node_t;
- typedef details::assignment_string_range_node<T> assignment_string_range_node_t;
- typedef details::conditional_string_node<T> conditional_string_node_t;
- typedef details::cons_conditional_str_node<T> cons_conditional_str_node_t;
+ typedef details::stringvar_node<T> stringvar_node_t;
+ typedef details::string_literal_node<T> string_literal_node_t;
+ typedef details::string_range_node<T> string_range_node_t;
+ typedef details::const_string_range_node<T> const_string_range_node_t;
+ typedef details::generic_string_range_node<T> generic_string_range_node_t;
+ typedef details::string_concat_node<T> string_concat_node_t;
+ typedef details::assignment_string_node<T> assignment_string_node_t;
+ typedef details::assignment_string_range_node<T> assignment_string_range_node_t;
+ typedef details::conditional_string_node<T> conditional_string_node_t;
+ typedef details::cons_conditional_str_node<T> cons_conditional_str_node_t;
#endif
typedef details::assignment_node<T> assignment_node_t;
- typedef details::assignment_vec_elem_node <T> assignment_vec_elem_node_t;
- typedef details::assignment_rebasevec_elem_node <T> assignment_rebasevec_elem_node_t;
+ typedef details::assignment_vec_elem_node<T> assignment_vec_elem_node_t;
+ typedef details::assignment_rebasevec_elem_node<T> assignment_rebasevec_elem_node_t;
typedef details::assignment_rebasevec_celem_node<T> assignment_rebasevec_celem_node_t;
- typedef details::assignment_vec_node <T> assignment_vec_node_t;
- typedef details::assignment_vecvec_node <T> assignment_vecvec_node_t;
- typedef details::scand_node<T> scand_node_t;
- typedef details::scor_node<T> scor_node_t;
- typedef lexer::token token_t;
- typedef expression_node_t* expression_node_ptr;
- typedef expression<T> expression_t;
- typedef symbol_table<T> symbol_table_t;
- typedef typename expression<T>::symtab_list_t symbol_table_list_t;
+ typedef details::assignment_vec_node<T> assignment_vec_node_t;
+ typedef details::assignment_vecvec_node<T> assignment_vecvec_node_t;
+ typedef details::conditional_vector_node<T> conditional_vector_node_t;
+ typedef details::scand_node<T> scand_node_t;
+ typedef details::scor_node<T> scor_node_t;
+ typedef lexer::token token_t;
+ typedef expression_node_t* expression_node_ptr;
+ typedef expression<T> expression_t;
+ typedef symbol_table<T> symbol_table_t;
+ typedef typename expression<T>::symtab_list_t symbol_table_list_t;
typedef details::vector_holder<T>* vector_holder_ptr;
- typedef typename details::functor_t<T> functor_t;
+ typedef typename details::functor_t<T> functor_t;
typedef typename functor_t::qfunc_t quaternary_functor_t;
- typedef typename functor_t::tfunc_t trinary_functor_t;
- typedef typename functor_t::bfunc_t binary_functor_t;
- typedef typename functor_t::ufunc_t unary_functor_t;
+ typedef typename functor_t::tfunc_t trinary_functor_t;
+ typedef typename functor_t::bfunc_t binary_functor_t;
+ typedef typename functor_t::ufunc_t unary_functor_t;
typedef details::operator_type operator_t;
- typedef std::map<operator_t, unary_functor_t> unary_op_map_t;
- typedef std::map<operator_t, binary_functor_t> binary_op_map_t;
- typedef std::map<operator_t,trinary_functor_t> trinary_op_map_t;
+ typedef std::map<operator_t, unary_functor_t > unary_op_map_t;
+ typedef std::map<operator_t, binary_functor_t > binary_op_map_t;
+ typedef std::map<operator_t, trinary_functor_t> trinary_op_map_t;
typedef std::map<std::string,std::pair<trinary_functor_t ,operator_t> > sf3_map_t;
typedef std::map<std::string,std::pair<quaternary_functor_t,operator_t> > sf4_map_t;
@@ -19167,28 +19543,28 @@
typedef std::multimap<std::string,details::base_operation_t,details::ilesscompare> base_ops_map_t;
typedef std::set<std::string,details::ilesscompare> disabled_func_set_t;
- typedef details::T0oT1_define<T, cref_t, cref_t> vov_t;
- typedef details::T0oT1_define<T, const_t, cref_t> cov_t;
- typedef details::T0oT1_define<T, cref_t, const_t> voc_t;
+ typedef details::T0oT1_define<T, cref_t , cref_t > vov_t;
+ typedef details::T0oT1_define<T, const_t, cref_t > cov_t;
+ typedef details::T0oT1_define<T, cref_t , const_t> voc_t;
- typedef details::T0oT1oT2_define<T, cref_t, cref_t, cref_t> vovov_t;
- typedef details::T0oT1oT2_define<T, cref_t, cref_t, const_t> vovoc_t;
- typedef details::T0oT1oT2_define<T, cref_t, const_t, cref_t> vocov_t;
- typedef details::T0oT1oT2_define<T, const_t, cref_t, cref_t> covov_t;
- typedef details::T0oT1oT2_define<T, const_t, cref_t, const_t> covoc_t;
- typedef details::T0oT1oT2_define<T, const_t, const_t, cref_t> cocov_t;
- typedef details::T0oT1oT2_define<T, cref_t, const_t, const_t> vococ_t;
+ typedef details::T0oT1oT2_define<T, cref_t , cref_t , cref_t > vovov_t;
+ typedef details::T0oT1oT2_define<T, cref_t , cref_t , const_t> vovoc_t;
+ typedef details::T0oT1oT2_define<T, cref_t , const_t, cref_t > vocov_t;
+ typedef details::T0oT1oT2_define<T, const_t, cref_t , cref_t > covov_t;
+ typedef details::T0oT1oT2_define<T, const_t, cref_t , const_t> covoc_t;
+ typedef details::T0oT1oT2_define<T, const_t, const_t, cref_t > cocov_t;
+ typedef details::T0oT1oT2_define<T, cref_t , const_t, const_t> vococ_t;
- typedef details::T0oT1oT2oT3_define<T, cref_t, cref_t, cref_t, cref_t> vovovov_t;
- typedef details::T0oT1oT2oT3_define<T, cref_t, cref_t, cref_t, const_t> vovovoc_t;
- typedef details::T0oT1oT2oT3_define<T, cref_t, cref_t, const_t, cref_t> vovocov_t;
- typedef details::T0oT1oT2oT3_define<T, cref_t, const_t, cref_t, cref_t> vocovov_t;
- typedef details::T0oT1oT2oT3_define<T, const_t, cref_t, cref_t, cref_t> covovov_t;
+ typedef details::T0oT1oT2oT3_define<T, cref_t , cref_t , cref_t , cref_t > vovovov_t;
+ typedef details::T0oT1oT2oT3_define<T, cref_t , cref_t , cref_t , const_t> vovovoc_t;
+ typedef details::T0oT1oT2oT3_define<T, cref_t , cref_t , const_t, cref_t > vovocov_t;
+ typedef details::T0oT1oT2oT3_define<T, cref_t , const_t, cref_t , cref_t > vocovov_t;
+ typedef details::T0oT1oT2oT3_define<T, const_t, cref_t , cref_t , cref_t > covovov_t;
- typedef details::T0oT1oT2oT3_define<T, const_t, cref_t, const_t, cref_t> covocov_t;
- typedef details::T0oT1oT2oT3_define<T, cref_t, const_t, cref_t, const_t> vocovoc_t;
- typedef details::T0oT1oT2oT3_define<T, const_t, cref_t, cref_t, const_t> covovoc_t;
- typedef details::T0oT1oT2oT3_define<T, cref_t, const_t, const_t, cref_t> vococov_t;
+ typedef details::T0oT1oT2oT3_define<T, const_t, cref_t , const_t, cref_t > covocov_t;
+ typedef details::T0oT1oT2oT3_define<T, cref_t , const_t, cref_t , const_t> vocovoc_t;
+ typedef details::T0oT1oT2oT3_define<T, const_t, cref_t , cref_t , const_t> covovoc_t;
+ typedef details::T0oT1oT2oT3_define<T, cref_t , const_t, const_t, cref_t > vococov_t;
typedef results_context<T> results_context_t;
@@ -19206,28 +19582,28 @@
};
typedef details::vector_holder<T> vector_holder_t;
- typedef variable_node_t* variable_node_ptr;
- typedef vector_holder_t* vector_holder_ptr;
- typedef expression_node_t* expression_node_ptr;
+ typedef variable_node_t* variable_node_ptr;
+ typedef vector_holder_t* vector_holder_ptr;
+ typedef expression_node_t* expression_node_ptr;
#ifndef exprtk_disable_string_capabilities
- typedef stringvar_node_t* stringvar_node_ptr;
+ typedef stringvar_node_t* stringvar_node_ptr;
#endif
scope_element()
- : name("???"),
- size (std::numeric_limits<std::size_t>::max()),
- index(std::numeric_limits<std::size_t>::max()),
- depth(std::numeric_limits<std::size_t>::max()),
- ref_count(0),
- ip_index (0),
- type (e_none),
- active(false),
- data (0),
- var_node(0),
- vec_node(0)
- #ifndef exprtk_disable_string_capabilities
- ,str_node(0)
- #endif
+ : name("???")
+ , size (std::numeric_limits<std::size_t>::max())
+ , index(std::numeric_limits<std::size_t>::max())
+ , depth(std::numeric_limits<std::size_t>::max())
+ , ref_count(0)
+ , ip_index (0)
+ , type (e_none)
+ , active(false)
+ , data (0)
+ , var_node (0)
+ , vec_node (0)
+ #ifndef exprtk_disable_string_capabilities
+ , str_node(0)
+ #endif
{}
bool operator < (const scope_element& se) const
@@ -19287,12 +19663,12 @@
public:
typedef expression_node_t* expression_node_ptr;
- typedef variable_node_t* variable_node_ptr;
- typedef parser<T> parser_t;
+ typedef variable_node_t* variable_node_ptr;
+ typedef parser<T> parser_t;
explicit scope_element_manager(parser<T>& p)
- : parser_(p),
- input_param_cnt_(0)
+ : parser_(p)
+ , input_param_cnt_(0)
{}
inline std::size_t size() const
@@ -19401,26 +19777,24 @@
inline void free_element(scope_element& se)
{
- #ifdef exprtk_enable_debugging
exprtk_debug(("free_element() - se[%s]\n", se.name.c_str()));
- #endif
switch (se.type)
{
- case scope_element::e_variable : if (se.data ) delete (T*) se.data;
- if (se.var_node) delete se.var_node;
+ case scope_element::e_variable : delete reinterpret_cast<T*>(se.data);
+ delete se.var_node;
break;
- case scope_element::e_vector : if (se.data ) delete[] (T*) se.data;
- if (se.vec_node) delete se.vec_node;
+ case scope_element::e_vector : delete[] reinterpret_cast<T*>(se.data);
+ delete se.vec_node;
break;
- case scope_element::e_vecelem : if (se.var_node) delete se.var_node;
+ case scope_element::e_vecelem : delete se.var_node;
break;
#ifndef exprtk_disable_string_capabilities
- case scope_element::e_string : if (se.data ) delete (std::string*) se.data;
- if (se.str_node) delete se.str_node;
+ case scope_element::e_string : delete reinterpret_cast<std::string*>(se.data);
+ delete se.str_node;
break;
#endif
@@ -19473,7 +19847,8 @@
private:
- scope_element_manager& operator=(const scope_element_manager&);
+ scope_element_manager(const scope_element_manager&) exprtk_delete;
+ scope_element_manager& operator=(const scope_element_manager&) exprtk_delete;
parser_t& parser_;
std::vector<scope_element> element_;
@@ -19513,7 +19888,8 @@
private:
- scope_handler& operator=(const scope_handler&);
+ scope_handler(const scope_handler&) exprtk_delete;
+ scope_handler& operator=(const scope_handler&) exprtk_delete;
parser_t& parser_;
};
@@ -19525,8 +19901,8 @@
typedef parser<T> parser_t;
explicit stack_limit_handler(parser<T>& p)
- : parser_(p),
- limit_exceeded_(false)
+ : parser_(p)
+ , limit_exceeded_(false)
{
if (++parser_.state_.stack_depth > parser_.settings_.max_stack_depth_)
{
@@ -19551,7 +19927,8 @@
private:
- stack_limit_handler& operator=(const stack_limit_handler&);
+ stack_limit_handler(const stack_limit_handler&) exprtk_delete;
+ stack_limit_handler& operator=(const stack_limit_handler&) exprtk_delete;
parser_t& parser_;
bool limit_exceeded_;
@@ -19561,14 +19938,14 @@
{
symbol_table_list_t symtab_list_;
- typedef typename symbol_table_t::local_data_t local_data_t;
- typedef typename symbol_table_t::variable_ptr variable_ptr;
- typedef typename symbol_table_t::function_ptr function_ptr;
+ typedef typename symbol_table_t::local_data_t local_data_t;
+ typedef typename symbol_table_t::variable_ptr variable_ptr;
+ typedef typename symbol_table_t::function_ptr function_ptr;
#ifndef exprtk_disable_string_capabilities
typedef typename symbol_table_t::stringvar_ptr stringvar_ptr;
#endif
- typedef typename symbol_table_t::vector_holder_ptr vector_holder_ptr;
- typedef typename symbol_table_t::vararg_function_ptr vararg_function_ptr;
+ typedef typename symbol_table_t::vector_holder_ptr vector_holder_ptr;
+ typedef typename symbol_table_t::vararg_function_ptr vararg_function_ptr;
typedef typename symbol_table_t::generic_function_ptr generic_function_ptr;
inline bool empty() const
@@ -19827,7 +20204,7 @@
continue;
else if (!local_data(i).stringvar_store.symbol_exists(symbol_name))
continue;
- else if ( local_data(i).stringvar_store.is_constant(symbol_name))
+ else if (local_data(i).stringvar_store.is_constant(symbol_name))
return true;
}
@@ -20057,8 +20434,7 @@
: mode(m)
{}
- virtual ~unknown_symbol_resolver()
- {}
+ virtual ~unknown_symbol_resolver() {}
virtual bool process(const std::string& /*unknown_symbol*/,
usr_symbol_type& st,
@@ -20112,12 +20488,12 @@
typedef std::vector<symbol_t> symbol_list_t;
dependent_entity_collector(const std::size_t options = e_ct_none)
- : options_(options),
- collect_variables_ ((options_ & e_ct_variables ) == e_ct_variables ),
- collect_functions_ ((options_ & e_ct_functions ) == e_ct_functions ),
- collect_assignments_((options_ & e_ct_assignments) == e_ct_assignments),
- return_present_ (false),
- final_stmt_return_(false)
+ : options_(options)
+ , collect_variables_ ((options_ & e_ct_variables ) == e_ct_variables )
+ , collect_functions_ ((options_ & e_ct_functions ) == e_ct_functions )
+ , collect_assignments_((options_ & e_ct_assignments) == e_ct_assignments)
+ , return_present_ (false)
+ , final_stmt_return_(false)
{}
template <typename Allocator,
@@ -20290,20 +20666,20 @@
enum settings_base_funcs
{
e_bf_unknown = 0,
- e_bf_abs , e_bf_acos , e_bf_acosh , e_bf_asin ,
- e_bf_asinh , e_bf_atan , e_bf_atan2 , e_bf_atanh ,
- e_bf_avg , e_bf_ceil , e_bf_clamp , e_bf_cos ,
- e_bf_cosh , e_bf_cot , e_bf_csc , e_bf_equal ,
- e_bf_erf , e_bf_erfc , e_bf_exp , e_bf_expm1 ,
- e_bf_floor , e_bf_frac , e_bf_hypot , e_bf_iclamp ,
- e_bf_like , e_bf_log , e_bf_log10 , e_bf_log1p ,
- e_bf_log2 , e_bf_logn , e_bf_mand , e_bf_max ,
- e_bf_min , e_bf_mod , e_bf_mor , e_bf_mul ,
- e_bf_ncdf , e_bf_pow , e_bf_root , e_bf_round ,
- e_bf_roundn , e_bf_sec , e_bf_sgn , e_bf_sin ,
- e_bf_sinc , e_bf_sinh , e_bf_sqrt , e_bf_sum ,
- e_bf_swap , e_bf_tan , e_bf_tanh , e_bf_trunc ,
- e_bf_not_equal , e_bf_inrange , e_bf_deg2grad , e_bf_deg2rad,
+ e_bf_abs , e_bf_acos , e_bf_acosh , e_bf_asin ,
+ e_bf_asinh , e_bf_atan , e_bf_atan2 , e_bf_atanh ,
+ e_bf_avg , e_bf_ceil , e_bf_clamp , e_bf_cos ,
+ e_bf_cosh , e_bf_cot , e_bf_csc , e_bf_equal ,
+ e_bf_erf , e_bf_erfc , e_bf_exp , e_bf_expm1 ,
+ e_bf_floor , e_bf_frac , e_bf_hypot , e_bf_iclamp ,
+ e_bf_like , e_bf_log , e_bf_log10 , e_bf_log1p ,
+ e_bf_log2 , e_bf_logn , e_bf_mand , e_bf_max ,
+ e_bf_min , e_bf_mod , e_bf_mor , e_bf_mul ,
+ e_bf_ncdf , e_bf_pow , e_bf_root , e_bf_round ,
+ e_bf_roundn , e_bf_sec , e_bf_sgn , e_bf_sin ,
+ e_bf_sinc , e_bf_sinh , e_bf_sqrt , e_bf_sum ,
+ e_bf_swap , e_bf_tan , e_bf_tanh , e_bf_trunc ,
+ e_bf_not_equal , e_bf_inrange , e_bf_deg2grad , e_bf_deg2rad ,
e_bf_rad2deg , e_bf_grad2deg
};
@@ -20321,8 +20697,8 @@
enum settings_logic_opr
{
e_logic_unknown = 0,
- e_logic_and, e_logic_nand, e_logic_nor,
- e_logic_not, e_logic_or, e_logic_xnor,
+ e_logic_and, e_logic_nand , e_logic_nor ,
+ e_logic_not, e_logic_or , e_logic_xnor,
e_logic_xor, e_logic_scand, e_logic_scor
};
@@ -20343,22 +20719,23 @@
enum settings_inequality_opr
{
e_ineq_unknown = 0,
- e_ineq_lt, e_ineq_lte, e_ineq_eq,
- e_ineq_equal, e_ineq_ne, e_ineq_nequal,
- e_ineq_gte, e_ineq_gt
+ e_ineq_lt , e_ineq_lte, e_ineq_eq ,
+ e_ineq_equal, e_ineq_ne , e_ineq_nequal,
+ e_ineq_gte , e_ineq_gt
};
- static const std::size_t compile_all_opts = e_replacer +
- e_joiner +
- e_numeric_check +
- e_bracket_check +
- e_sequence_check +
- e_commutative_check +
- e_strength_reduction;
+ static const std::size_t compile_all_opts =
+ e_replacer +
+ e_joiner +
+ e_numeric_check +
+ e_bracket_check +
+ e_sequence_check +
+ e_commutative_check +
+ e_strength_reduction;
settings_store(const std::size_t compile_options = compile_all_opts)
- : max_stack_depth_(400),
- max_node_depth_(10000)
+ : max_stack_depth_(400)
+ , max_node_depth_(10000)
{
load_compile_options(compile_options);
}
@@ -20776,9 +21153,9 @@
return (*this);
}
- void set_max_stack_depth(const std::size_t mx_stack_depth)
+ void set_max_stack_depth(const std::size_t max_stack_depth)
{
- max_stack_depth_ = mx_stack_depth;
+ max_stack_depth_ = max_stack_depth;
}
void set_max_node_depth(const std::size_t max_node_depth)
@@ -20815,7 +21192,7 @@
case details::e_mulass : return "*=";
case details::e_divass : return "/=";
case details::e_modass : return "%=";
- default : return "";
+ default : return "" ;
}
}
@@ -20828,7 +21205,7 @@
case details::e_mul : return "*";
case details::e_div : return "/";
case details::e_mod : return "%";
- default : return "";
+ default : return "" ;
}
}
@@ -20836,15 +21213,15 @@
{
switch (opr)
{
- case details::e_lt : return "<";
+ case details::e_lt : return "<" ;
case details::e_lte : return "<=";
case details::e_eq : return "==";
- case details::e_equal : return "=";
+ case details::e_equal : return "=" ;
case details::e_ne : return "!=";
case details::e_nequal: return "<>";
case details::e_gte : return ">=";
- case details::e_gt : return ">";
- default : return "";
+ case details::e_gt : return ">" ;
+ default : return "" ;
}
}
@@ -20893,21 +21270,21 @@
typedef settings_store settings_t;
parser(const settings_t& settings = settings_t())
- : settings_(settings),
- resolve_unknown_symbol_(false),
- results_context_(0),
- unknown_symbol_resolver_(reinterpret_cast<unknown_symbol_resolver*>(0)),
+ : settings_(settings)
+ , resolve_unknown_symbol_(false)
+ , results_context_(0)
+ , unknown_symbol_resolver_(reinterpret_cast<unknown_symbol_resolver*>(0))
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning (disable:4355)
#endif
- sem_(*this),
+ , sem_(*this)
#ifdef _MSC_VER
#pragma warning(pop)
#endif
- operator_joiner_2_(2),
- operator_joiner_3_(3),
- loop_runtime_check_(0)
+ , operator_joiner_2_(2)
+ , operator_joiner_3_(3)
+ , loop_runtime_check_(0)
{
init_precompilation();
@@ -20928,19 +21305,18 @@
expression_generator_.set_strength_reduction_state(settings_.strength_reduction_enabled());
}
- ~parser()
- {}
+ ~parser() {}
inline void init_precompilation()
{
- if (settings_.collect_variables_enabled())
- dec_.collect_variables() = true;
+ dec_.collect_variables() =
+ settings_.collect_variables_enabled();
- if (settings_.collect_functions_enabled())
- dec_.collect_functions() = true;
+ dec_.collect_functions() =
+ settings_.collect_functions_enabled();
- if (settings_.collect_assignments_enabled())
- dec_.collect_assignments() = true;
+ dec_.collect_assignments() =
+ settings_.collect_assignments_enabled();
if (settings_.replacer_enabled())
{
@@ -21094,11 +21470,8 @@
inline expression_t compile(const std::string& expression_string, symbol_table_t& symtab)
{
expression_t expression;
-
expression.register_symbol_table(symtab);
-
compile(expression_string,expression);
-
return expression;
}
@@ -21419,7 +21792,7 @@
scoped_vec_delete<expression_node_t> sdd((*this),arg_list);
lexer::token begin_token;
- lexer::token end_token;
+ lexer::token end_token;
for ( ; ; )
{
@@ -21552,39 +21925,39 @@
switch (current_token().type)
{
- case token_t::e_assign : current_state.set(e_level00,e_level00, details::e_assign); break;
- case token_t::e_addass : current_state.set(e_level00,e_level00, details::e_addass); break;
- case token_t::e_subass : current_state.set(e_level00,e_level00, details::e_subass); break;
- case token_t::e_mulass : current_state.set(e_level00,e_level00, details::e_mulass); break;
- case token_t::e_divass : current_state.set(e_level00,e_level00, details::e_divass); break;
- case token_t::e_modass : current_state.set(e_level00,e_level00, details::e_modass); break;
- case token_t::e_swap : current_state.set(e_level00,e_level00, details::e_swap ); break;
- case token_t::e_lt : current_state.set(e_level05,e_level06, details:: e_lt); break;
- case token_t::e_lte : current_state.set(e_level05,e_level06, details:: e_lte); break;
- case token_t::e_eq : current_state.set(e_level05,e_level06, details:: e_eq); break;
- case token_t::e_ne : current_state.set(e_level05,e_level06, details:: e_ne); break;
- case token_t::e_gte : current_state.set(e_level05,e_level06, details:: e_gte); break;
- case token_t::e_gt : current_state.set(e_level05,e_level06, details:: e_gt); break;
- case token_t::e_add : current_state.set(e_level07,e_level08, details:: e_add); break;
- case token_t::e_sub : current_state.set(e_level07,e_level08, details:: e_sub); break;
- case token_t::e_div : current_state.set(e_level10,e_level11, details:: e_div); break;
- case token_t::e_mul : current_state.set(e_level10,e_level11, details:: e_mul); break;
- case token_t::e_mod : current_state.set(e_level10,e_level11, details:: e_mod); break;
- case token_t::e_pow : current_state.set(e_level12,e_level12, details:: e_pow); break;
+ case token_t::e_assign : current_state.set(e_level00, e_level00, details::e_assign); break;
+ case token_t::e_addass : current_state.set(e_level00, e_level00, details::e_addass); break;
+ case token_t::e_subass : current_state.set(e_level00, e_level00, details::e_subass); break;
+ case token_t::e_mulass : current_state.set(e_level00, e_level00, details::e_mulass); break;
+ case token_t::e_divass : current_state.set(e_level00, e_level00, details::e_divass); break;
+ case token_t::e_modass : current_state.set(e_level00, e_level00, details::e_modass); break;
+ case token_t::e_swap : current_state.set(e_level00, e_level00, details::e_swap ); break;
+ case token_t::e_lt : current_state.set(e_level05, e_level06, details::e_lt ); break;
+ case token_t::e_lte : current_state.set(e_level05, e_level06, details::e_lte ); break;
+ case token_t::e_eq : current_state.set(e_level05, e_level06, details::e_eq ); break;
+ case token_t::e_ne : current_state.set(e_level05, e_level06, details::e_ne ); break;
+ case token_t::e_gte : current_state.set(e_level05, e_level06, details::e_gte ); break;
+ case token_t::e_gt : current_state.set(e_level05, e_level06, details::e_gt ); break;
+ case token_t::e_add : current_state.set(e_level07, e_level08, details::e_add ); break;
+ case token_t::e_sub : current_state.set(e_level07, e_level08, details::e_sub ); break;
+ case token_t::e_div : current_state.set(e_level10, e_level11, details::e_div ); break;
+ case token_t::e_mul : current_state.set(e_level10, e_level11, details::e_mul ); break;
+ case token_t::e_mod : current_state.set(e_level10, e_level11, details::e_mod ); break;
+ case token_t::e_pow : current_state.set(e_level12, e_level12, details::e_pow ); break;
default : if (token_t::e_symbol == current_token().type)
{
- static const std::string s_and = "and";
- static const std::string s_nand = "nand";
- static const std::string s_or = "or";
- static const std::string s_nor = "nor";
- static const std::string s_xor = "xor";
- static const std::string s_xnor = "xnor";
- static const std::string s_in = "in";
- static const std::string s_like = "like";
+ static const std::string s_and = "and" ;
+ static const std::string s_nand = "nand" ;
+ static const std::string s_or = "or" ;
+ static const std::string s_nor = "nor" ;
+ static const std::string s_xor = "xor" ;
+ static const std::string s_xnor = "xnor" ;
+ static const std::string s_in = "in" ;
+ static const std::string s_like = "like" ;
static const std::string s_ilike = "ilike";
- static const std::string s_and1 = "&";
- static const std::string s_or1 = "|";
- static const std::string s_not = "not";
+ static const std::string s_and1 = "&" ;
+ static const std::string s_or1 = "|" ;
+ static const std::string s_not = "not" ;
if (details::imatch(current_token().value,s_and))
{
@@ -21725,11 +22098,11 @@
if (0 != (right_branch = parse_expression(current_state.right)))
{
if (
- details::is_return_node( expression) ||
+ details::is_return_node(expression ) ||
details::is_return_node(right_branch)
)
{
- free_node(node_allocator_, expression);
+ free_node(node_allocator_, expression );
free_node(node_allocator_, right_branch);
set_error(
@@ -21762,7 +22135,7 @@
exprtk_error_location));
}
- free_node(node_allocator_, expression);
+ free_node(node_allocator_, expression );
free_node(node_allocator_, right_branch);
return error_node();
@@ -21771,7 +22144,7 @@
{
if (
token_is(token_t::e_ternary,prsrhlpr_t::e_hold) &&
- (precedence == e_level00)
+ (e_level00 == precedence)
)
{
expression = parse_ternary_conditional_statement(new_expression);
@@ -21863,9 +22236,9 @@
struct scoped_expression_delete
{
scoped_expression_delete(parser<T>& pr, expression_node_ptr& expression)
- : delete_ptr(true),
- parser_(pr),
- expression_(expression)
+ : delete_ptr(true)
+ , parser_(pr)
+ , expression_(expression)
{}
~scoped_expression_delete()
@@ -21882,7 +22255,8 @@
private:
- scoped_expression_delete& operator=(const scoped_expression_delete&);
+ scoped_expression_delete(const scoped_expression_delete&) exprtk_delete;
+ scoped_expression_delete& operator=(const scoped_expression_delete&) exprtk_delete;
};
template <typename Type, std::size_t N>
@@ -21891,15 +22265,15 @@
typedef Type* ptr_t;
scoped_delete(parser<T>& pr, ptr_t& p)
- : delete_ptr(true),
- parser_(pr),
- p_(&p)
+ : delete_ptr(true)
+ , parser_(pr)
+ , p_(&p)
{}
scoped_delete(parser<T>& pr, ptr_t (&p)[N])
- : delete_ptr(true),
- parser_(pr),
- p_(&p[0])
+ : delete_ptr(true)
+ , parser_(pr)
+ , p_(&p[0])
{}
~scoped_delete()
@@ -21919,7 +22293,8 @@
private:
- scoped_delete<Type,N>& operator=(const scoped_delete<Type,N>&);
+ scoped_delete(const scoped_delete<Type,N>&) exprtk_delete;
+ scoped_delete<Type,N>& operator=(const scoped_delete<Type,N>&) exprtk_delete;
};
template <typename Type>
@@ -21928,9 +22303,9 @@
typedef Type* ptr_t;
scoped_deq_delete(parser<T>& pr, std::deque<ptr_t>& deq)
- : delete_ptr(true),
- parser_(pr),
- deq_(deq)
+ : delete_ptr(true)
+ , parser_(pr)
+ , deq_(deq)
{}
~scoped_deq_delete()
@@ -21952,7 +22327,8 @@
private:
- scoped_deq_delete<Type>& operator=(const scoped_deq_delete<Type>&);
+ scoped_deq_delete(const scoped_deq_delete<Type>&) exprtk_delete;
+ scoped_deq_delete<Type>& operator=(const scoped_deq_delete<Type>&) exprtk_delete;
};
template <typename Type>
@@ -21961,9 +22337,9 @@
typedef Type* ptr_t;
scoped_vec_delete(parser<T>& pr, std::vector<ptr_t>& vec)
- : delete_ptr(true),
- parser_(pr),
- vec_(vec)
+ : delete_ptr(true)
+ , parser_(pr)
+ , vec_(vec)
{}
~scoped_vec_delete()
@@ -21985,7 +22361,8 @@
private:
- scoped_vec_delete<Type>& operator=(const scoped_vec_delete<Type>&);
+ scoped_vec_delete(const scoped_vec_delete<Type>&) exprtk_delete;
+ scoped_vec_delete<Type>& operator=(const scoped_vec_delete<Type>&) exprtk_delete;
};
struct scoped_bool_negator
@@ -22003,8 +22380,8 @@
struct scoped_bool_or_restorer
{
explicit scoped_bool_or_restorer(bool& bb)
- : b(bb),
- original_value_(bb)
+ : b(bb)
+ , original_value_(bb)
{}
~scoped_bool_or_restorer()
@@ -22166,7 +22543,7 @@
else
result = expression_generator_.function(function,branch);
- sd.delete_ptr = false;
+ sd.delete_ptr = (0 == result);
return result;
}
@@ -22396,7 +22773,7 @@
#ifndef exprtk_disable_string_capabilities
if (result)
{
- const bool consq_is_str = is_generally_string_node( consequent);
+ const bool consq_is_str = is_generally_string_node(consequent );
const bool alter_is_str = is_generally_string_node(alternative);
if (consq_is_str || alter_is_str)
@@ -22410,7 +22787,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR037 - Return types of ternary if-statement differ",
+ "ERR037 - Return types of if-statement differ: string/non-string",
exprtk_error_location));
result = false;
@@ -22418,6 +22795,29 @@
}
#endif
+ if (result)
+ {
+ const bool consq_is_vec = is_ivector_node(consequent );
+ const bool alter_is_vec = is_ivector_node(alternative);
+
+ if (consq_is_vec || alter_is_vec)
+ {
+ if (consq_is_vec && alter_is_vec)
+ {
+ return expression_generator_
+ .conditional_vector(condition, consequent, alternative);
+ }
+
+ set_error(
+ make_error(parser_error::e_syntax,
+ current_token(),
+ "ERR038 - Return types of if-statement differ: vector/non-vector",
+ exprtk_error_location));
+
+ result = false;
+ }
+ }
+
if (!result)
{
free_node(node_allocator_, condition );
@@ -22445,7 +22845,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR038 - Failed to parse body of consequent for if-statement",
+ "ERR039 - Failed to parse body of consequent for if-statement",
exprtk_error_location));
result = false;
@@ -22468,7 +22868,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR039 - Expected ';' at the end of the consequent for if-statement",
+ "ERR040 - Expected ';' at the end of the consequent for if-statement",
exprtk_error_location));
result = false;
@@ -22479,7 +22879,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR040 - Failed to parse body of consequent for if-statement",
+ "ERR041 - Failed to parse body of consequent for if-statement",
exprtk_error_location));
result = false;
@@ -22499,7 +22899,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR041 - Failed to parse body of the 'else' for if-statement",
+ "ERR042 - Failed to parse body of the 'else' for if-statement",
exprtk_error_location));
result = false;
@@ -22512,7 +22912,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR042 - Failed to parse body of if-else statement",
+ "ERR043 - Failed to parse body of if-else statement",
exprtk_error_location));
result = false;
@@ -22525,7 +22925,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR043 - Expected ';' at the end of the 'else-if' for the if-statement",
+ "ERR044 - Expected ';' at the end of the 'else-if' for the if-statement",
exprtk_error_location));
result = false;
@@ -22536,7 +22936,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR044 - Failed to parse body of the 'else' for if-statement",
+ "ERR045 - Failed to parse body of the 'else' for if-statement",
exprtk_error_location));
result = false;
@@ -22547,7 +22947,7 @@
#ifndef exprtk_disable_string_capabilities
if (result)
{
- const bool consq_is_str = is_generally_string_node( consequent);
+ const bool consq_is_str = is_generally_string_node(consequent );
const bool alter_is_str = is_generally_string_node(alternative);
if (consq_is_str || alter_is_str)
@@ -22561,7 +22961,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR045 - Return types of ternary if-statement differ",
+ "ERR046 - Return types of if-statement differ: string/non-string",
exprtk_error_location));
result = false;
@@ -22569,10 +22969,33 @@
}
#endif
+ if (result)
+ {
+ const bool consq_is_vec = is_ivector_node(consequent );
+ const bool alter_is_vec = is_ivector_node(alternative);
+
+ if (consq_is_vec || alter_is_vec)
+ {
+ if (consq_is_vec && alter_is_vec)
+ {
+ return expression_generator_
+ .conditional_vector(condition, consequent, alternative);
+ }
+
+ set_error(
+ make_error(parser_error::e_syntax,
+ current_token(),
+ "ERR047 - Return types of if-statement differ: vector/non-vector",
+ exprtk_error_location));
+
+ result = false;
+ }
+ }
+
if (!result)
{
- free_node(node_allocator_, condition);
- free_node(node_allocator_, consequent);
+ free_node(node_allocator_, condition );
+ free_node(node_allocator_, consequent );
free_node(node_allocator_, alternative);
return error_node();
@@ -22593,7 +23016,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR046 - Expected '(' at start of if-statement, instead got: '" + current_token().value + "'",
+ "ERR048 - Expected '(' at start of if-statement, instead got: '" + current_token().value + "'",
exprtk_error_location));
return error_node();
@@ -22603,7 +23026,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR047 - Failed to parse condition for if-statement",
+ "ERR049 - Failed to parse condition for if-statement",
exprtk_error_location));
return error_node();
@@ -22615,27 +23038,29 @@
}
else if (token_is(token_t::e_rbracket))
{
- // 00. if (x) y;
- // 01. if (x) y; else z;
- // 02. if (x) y; else {z0; ... zn;}
- // 03. if (x) y; else if (z) w;
- // 04. if (x) y; else if (z) w; else u;
- // 05. if (x) y; else if (z) w; else {u0; ... un;}
- // 06. if (x) y; else if (z) {w0; ... wn;}
- // 07. if (x) {y0; ... yn;}
- // 08. if (x) {y0; ... yn;} else z;
- // 09. if (x) {y0; ... yn;} else {z0; ... zn;};
- // 10. if (x) {y0; ... yn;} else if (z) w;
- // 11. if (x) {y0; ... yn;} else if (z) w; else u;
- // 12. if (x) {y0; ... nex;} else if (z) w; else {u0 ... un;}
- // 13. if (x) {y0; ... yn;} else if (z) {w0; ... wn;}
+ /*
+ 00. if (x) y;
+ 01. if (x) y; else z;
+ 02. if (x) y; else {z0; ... zn;}
+ 03. if (x) y; else if (z) w;
+ 04. if (x) y; else if (z) w; else u;
+ 05. if (x) y; else if (z) w; else {u0; ... un;}
+ 06. if (x) y; else if (z) {w0; ... wn;}
+ 07. if (x) {y0; ... yn;}
+ 08. if (x) {y0; ... yn;} else z;
+ 09. if (x) {y0; ... yn;} else {z0; ... zn;};
+ 10. if (x) {y0; ... yn;} else if (z) w;
+ 11. if (x) {y0; ... yn;} else if (z) w; else u;
+ 12. if (x) {y0; ... nex;} else if (z) w; else {u0 ... un;}
+ 13. if (x) {y0; ... yn;} else if (z) {w0; ... wn;}
+ */
return parse_conditional_statement_02(condition);
}
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR048 - Invalid if-statement",
+ "ERR050 - Invalid if-statement",
exprtk_error_location));
free_node(node_allocator_,condition);
@@ -22656,7 +23081,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR049 - Encountered invalid condition branch for ternary if-statement",
+ "ERR051 - Encountered invalid condition branch for ternary if-statement",
exprtk_error_location));
return error_node();
@@ -22666,7 +23091,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR050 - Expected '?' after condition of ternary if-statement",
+ "ERR052 - Expected '?' after condition of ternary if-statement",
exprtk_error_location));
result = false;
@@ -22676,7 +23101,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR051 - Failed to parse consequent for ternary if-statement",
+ "ERR053 - Failed to parse consequent for ternary if-statement",
exprtk_error_location));
result = false;
@@ -22686,7 +23111,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR052 - Expected ':' between ternary if-statement consequent and alternative",
+ "ERR054 - Expected ':' between ternary if-statement consequent and alternative",
exprtk_error_location));
result = false;
@@ -22696,7 +23121,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR053 - Failed to parse alternative for ternary if-statement",
+ "ERR055 - Failed to parse alternative for ternary if-statement",
exprtk_error_location));
result = false;
@@ -22705,7 +23130,7 @@
#ifndef exprtk_disable_string_capabilities
if (result)
{
- const bool consq_is_str = is_generally_string_node( consequent);
+ const bool consq_is_str = is_generally_string_node(consequent );
const bool alter_is_str = is_generally_string_node(alternative);
if (consq_is_str || alter_is_str)
@@ -22719,7 +23144,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR054 - Return types of ternary if-statement differ",
+ "ERR056 - Return types of ternary differ: string/non-string",
exprtk_error_location));
result = false;
@@ -22727,10 +23152,33 @@
}
#endif
+ if (result)
+ {
+ const bool consq_is_vec = is_ivector_node(consequent );
+ const bool alter_is_vec = is_ivector_node(alternative);
+
+ if (consq_is_vec || alter_is_vec)
+ {
+ if (consq_is_vec && alter_is_vec)
+ {
+ return expression_generator_
+ .conditional_vector(condition, consequent, alternative);
+ }
+
+ set_error(
+ make_error(parser_error::e_syntax,
+ current_token(),
+ "ERR057 - Return types of ternary differ: vector/non-vector",
+ exprtk_error_location));
+
+ result = false;
+ }
+ }
+
if (!result)
{
- free_node(node_allocator_, condition);
- free_node(node_allocator_, consequent);
+ free_node(node_allocator_, condition );
+ free_node(node_allocator_, consequent );
free_node(node_allocator_, alternative);
return error_node();
@@ -22747,7 +23195,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR055 - Invalid or disabled logic operation 'not'",
+ "ERR058 - Invalid or disabled logic operation 'not'",
exprtk_error_location));
return error_node();
@@ -22772,7 +23220,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR056 - Expected '(' at start of while-loop condition statement",
+ "ERR059 - Expected '(' at start of while-loop condition statement",
exprtk_error_location));
return error_node();
@@ -22782,7 +23230,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR057 - Failed to parse condition for while-loop",
+ "ERR060 - Failed to parse condition for while-loop",
exprtk_error_location));
return error_node();
@@ -22792,7 +23240,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR058 - Expected ')' at end of while-loop condition statement",
+ "ERR061 - Expected ')' at end of while-loop condition statement",
exprtk_error_location));
result = false;
@@ -22809,7 +23257,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR059 - Failed to parse body of while-loop"));
+ "ERR062 - Failed to parse body of while-loop"));
result = false;
}
else if (0 == (result_node = expression_generator_.while_loop(condition,
@@ -22819,7 +23267,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR060 - Failed to synthesize while-loop",
+ "ERR063 - Failed to synthesize while-loop",
exprtk_error_location));
result = false;
@@ -22828,8 +23276,8 @@
if (!result)
{
- free_node(node_allocator_, branch);
- free_node(node_allocator_, condition);
+ free_node(node_allocator_, branch );
+ free_node(node_allocator_, condition );
free_node(node_allocator_, result_node);
brkcnt_list_.pop_front();
@@ -22897,7 +23345,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR061 - Expected '" + token_t::to_str(seperator) + "' in body of repeat until loop",
+ "ERR064 - Expected '" + token_t::to_str(seperator) + "' in body of repeat until loop",
exprtk_error_location));
return error_node();
@@ -22921,7 +23369,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR062 - Failed to parse body of repeat until loop",
+ "ERR065 - Failed to parse body of repeat until loop",
exprtk_error_location));
return error_node();
@@ -22935,7 +23383,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR063 - Expected '(' before condition statement of repeat until loop",
+ "ERR066 - Expected '(' before condition statement of repeat until loop",
exprtk_error_location));
free_node(node_allocator_,branch);
@@ -22949,7 +23397,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR064 - Failed to parse condition for repeat until loop",
+ "ERR067 - Failed to parse condition for repeat until loop",
exprtk_error_location));
free_node(node_allocator_,branch);
@@ -22961,10 +23409,10 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR065 - Expected ')' after condition of repeat until loop",
+ "ERR068 - Expected ')' after condition of repeat until loop",
exprtk_error_location));
- free_node(node_allocator_, branch);
+ free_node(node_allocator_, branch );
free_node(node_allocator_, condition);
brkcnt_list_.pop_front();
@@ -22982,7 +23430,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR066 - Failed to synthesize repeat until loop",
+ "ERR069 - Failed to synthesize repeat until loop",
exprtk_error_location));
free_node(node_allocator_,condition);
@@ -23017,7 +23465,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR067 - Expected '(' at start of for-loop",
+ "ERR070 - Expected '(' at start of for-loop",
exprtk_error_location));
return error_node();
@@ -23037,7 +23485,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR068 - Expected a variable at the start of initialiser section of for-loop",
+ "ERR071 - Expected a variable at the start of initialiser section of for-loop",
exprtk_error_location));
return error_node();
@@ -23047,7 +23495,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR069 - Expected variable assignment of initialiser section of for-loop",
+ "ERR072 - Expected variable assignment of initialiser section of for-loop",
exprtk_error_location));
return error_node();
@@ -23062,7 +23510,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR070 - For-loop variable '" + loop_counter_symbol+ "' is being shadowed by a previous declaration",
+ "ERR073 - For-loop variable '" + loop_counter_symbol+ "' is being shadowed by a previous declaration",
exprtk_error_location));
return error_node();
@@ -23072,7 +23520,7 @@
if (
!se->active &&
(se->name == loop_counter_symbol) &&
- (se->type == scope_element::e_variable)
+ (se->type == scope_element::e_variable)
)
{
se->active = true;
@@ -23087,14 +23535,14 @@
nse.type = scope_element::e_variable;
nse.depth = state_.scope_depth;
nse.data = new T(T(0));
- nse.var_node = node_allocator_.allocate<variable_node_t>(*(T*)(nse.data));
+ nse.var_node = node_allocator_.allocate<variable_node_t>(*reinterpret_cast<T*>(nse.data));
if (!sem_.add_element(nse))
{
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR071 - Failed to add new local variable '" + loop_counter_symbol + "' to SEM",
+ "ERR074 - Failed to add new local variable '" + loop_counter_symbol + "' to SEM",
exprtk_error_location));
sem_.free_element(nse);
@@ -23116,7 +23564,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR072 - Failed to parse initialiser of for-loop",
+ "ERR075 - Failed to parse initialiser of for-loop",
exprtk_error_location));
result = false;
@@ -23126,7 +23574,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR073 - Expected ';' after initialiser of for-loop",
+ "ERR076 - Expected ';' after initialiser of for-loop",
exprtk_error_location));
result = false;
@@ -23140,7 +23588,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR074 - Failed to parse condition of for-loop",
+ "ERR077 - Failed to parse condition of for-loop",
exprtk_error_location));
result = false;
@@ -23150,7 +23598,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR075 - Expected ';' after condition section of for-loop",
+ "ERR078 - Expected ';' after condition section of for-loop",
exprtk_error_location));
result = false;
@@ -23164,7 +23612,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR076 - Failed to parse incrementor of for-loop",
+ "ERR079 - Failed to parse incrementor of for-loop",
exprtk_error_location));
result = false;
@@ -23174,7 +23622,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR077 - Expected ')' after incrementor section of for-loop",
+ "ERR080 - Expected ')' after incrementor section of for-loop",
exprtk_error_location));
result = false;
@@ -23192,7 +23640,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR078 - Failed to parse body of for-loop",
+ "ERR081 - Failed to parse body of for-loop",
exprtk_error_location));
result = false;
@@ -23207,9 +23655,9 @@
}
free_node(node_allocator_, initialiser);
- free_node(node_allocator_, condition);
+ free_node(node_allocator_, condition );
free_node(node_allocator_, incrementor);
- free_node(node_allocator_, loop_body);
+ free_node(node_allocator_, loop_body );
if (!brkcnt_list_.empty())
{
@@ -23242,7 +23690,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR079 - Expected keyword 'switch'",
+ "ERR082 - Expected keyword 'switch'",
exprtk_error_location));
return error_node();
@@ -23257,7 +23705,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR080 - Expected '{' for call to switch statement",
+ "ERR083 - Expected '{' for call to switch statement",
exprtk_error_location));
return error_node();
@@ -23282,7 +23730,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR081 - Expected ':' for case of switch statement",
+ "ERR084 - Expected ':' for case of switch statement",
exprtk_error_location));
free_node(node_allocator_, condition);
@@ -23303,10 +23751,10 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR082 - Expected ';' at end of case for switch statement",
+ "ERR085 - Expected ';' at end of case for switch statement",
exprtk_error_location));
- free_node(node_allocator_, condition);
+ free_node(node_allocator_, condition );
free_node(node_allocator_, consequent);
return error_node();
@@ -23315,12 +23763,12 @@
// Can we optimise away the case statement?
if (is_constant_node(condition) && is_false(condition))
{
- free_node(node_allocator_, condition);
+ free_node(node_allocator_, condition );
free_node(node_allocator_, consequent);
}
else
{
- arg_list.push_back( condition);
+ arg_list.push_back(condition );
arg_list.push_back(consequent);
}
@@ -23332,7 +23780,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR083 - Multiple default cases for switch statement",
+ "ERR086 - Multiple default cases for switch statement",
exprtk_error_location));
return error_node();
@@ -23345,7 +23793,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR084 - Expected ':' for default of switch statement",
+ "ERR087 - Expected ':' for default of switch statement",
exprtk_error_location));
return error_node();
@@ -23363,7 +23811,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR085 - Expected ';' at end of default for switch statement",
+ "ERR088 - Expected ';' at end of default for switch statement",
exprtk_error_location));
return error_node();
@@ -23376,7 +23824,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR086 - Expected '}' at end of switch statement",
+ "ERR089 - Expected '}' at end of switch statement",
exprtk_error_location));
return error_node();
@@ -23407,7 +23855,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR087 - Expected token '[*]'",
+ "ERR090 - Expected token '[*]'",
exprtk_error_location));
return error_node();
@@ -23422,7 +23870,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR088 - Expected '{' for call to [*] statement",
+ "ERR091 - Expected '{' for call to [*] statement",
exprtk_error_location));
return error_node();
@@ -23435,7 +23883,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR089 - Expected a 'case' statement for multi-switch",
+ "ERR092 - Expected a 'case' statement for multi-switch",
exprtk_error_location));
return error_node();
@@ -23453,7 +23901,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR090 - Expected ':' for case of [*] statement",
+ "ERR093 - Expected ':' for case of [*] statement",
exprtk_error_location));
return error_node();
@@ -23469,7 +23917,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR091 - Expected ';' at end of case for [*] statement",
+ "ERR094 - Expected ';' at end of case for [*] statement",
exprtk_error_location));
return error_node();
@@ -23478,12 +23926,12 @@
// Can we optimise away the case statement?
if (is_constant_node(condition) && is_false(condition))
{
- free_node(node_allocator_, condition);
+ free_node(node_allocator_, condition );
free_node(node_allocator_, consequent);
}
else
{
- arg_list.push_back( condition);
+ arg_list.push_back(condition );
arg_list.push_back(consequent);
}
@@ -23498,7 +23946,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR092 - Expected '}' at end of [*] statement",
+ "ERR095 - Expected '}' at end of [*] statement",
exprtk_error_location));
return error_node();
@@ -23539,7 +23987,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR093 - Unsupported vararg function: " + symbol,
+ "ERR096 - Unsupported vararg function: " + symbol,
exprtk_error_location));
return error_node();
@@ -23556,7 +24004,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR094 - Expected '(' for call to vararg function: " + symbol,
+ "ERR097 - Expected '(' for call to vararg function: " + symbol,
exprtk_error_location));
return error_node();
@@ -23578,7 +24026,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR095 - Expected ',' for call to vararg function: " + symbol,
+ "ERR098 - Expected ',' for call to vararg function: " + symbol,
exprtk_error_location));
return error_node();
@@ -23599,7 +24047,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR096 - Expected '[' as start of string range definition",
+ "ERR099 - Expected '[' as start of string range definition",
exprtk_error_location));
free_node(node_allocator_,expression);
@@ -23627,10 +24075,11 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR097 - Failed to generate string range node",
+ "ERR100 - Failed to generate string range node",
exprtk_error_location));
free_node(node_allocator_,expression);
+ rp.free();
}
rp.clear();
@@ -23732,8 +24181,8 @@
}
if (
- return_node_present ||
- side_effect_list.back() ||
+ return_node_present ||
+ side_effect_list.back() ||
(expression_list.size() > 1)
)
state_.activate_side_effect("simplify()");
@@ -23763,7 +24212,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR098 - Expected '" + token_t::to_str(close_bracket) + "' for call to multi-sequence" +
+ "ERR101 - Expected '" + token_t::to_str(close_bracket) + "' for call to multi-sequence" +
((!source.empty()) ? std::string(" section of " + source): ""),
exprtk_error_location));
@@ -23810,7 +24259,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR099 - Expected '" + details::to_str(seperator) + "' for call to multi-sequence section of " + source,
+ "ERR102 - Expected '" + details::to_str(seperator) + "' for call to multi-sequence section of " + source,
exprtk_error_location));
return error_node();
@@ -23844,7 +24293,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR100 - Expected '[' for start of range",
+ "ERR103 - Expected '[' for start of range",
exprtk_error_location));
return false;
@@ -23865,7 +24314,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR101 - Failed parse begin section of range",
+ "ERR104 - Failed parse begin section of range",
exprtk_error_location));
return false;
@@ -23888,7 +24337,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR102 - Range lower bound less than zero! Constraint: r0 >= 0",
+ "ERR105 - Range lower bound less than zero! Constraint: r0 >= 0",
exprtk_error_location));
return false;
@@ -23905,7 +24354,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR103 - Expected ':' for break in range",
+ "ERR106 - Expected ':' for break in range",
exprtk_error_location));
rp.free();
@@ -23928,7 +24377,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR104 - Failed parse end section of range",
+ "ERR107 - Failed parse end section of range",
exprtk_error_location));
rp.free();
@@ -23953,9 +24402,11 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR105 - Range upper bound less than zero! Constraint: r1 >= 0",
+ "ERR108 - Range upper bound less than zero! Constraint: r1 >= 0",
exprtk_error_location));
+ rp.free();
+
return false;
}
}
@@ -23970,7 +24421,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR106 - Expected ']' for start of range",
+ "ERR109 - Expected ']' for start of range",
exprtk_error_location));
rp.free();
@@ -23998,7 +24449,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR107 - Invalid range, Constraint: r0 <= r1",
+ "ERR110 - Invalid range, Constraint: r0 <= r1",
exprtk_error_location));
return false;
@@ -24039,7 +24490,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR108 - Unknown string symbol",
+ "ERR111 - Unknown string symbol",
exprtk_error_location));
return error_node();
@@ -24154,7 +24605,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR109 - Overflow in range for string: '" + const_str + "'[" +
+ "ERR112 - Overflow in range for string: '" + const_str + "'[" +
(rp.n0_c.first ? details::to_str(static_cast<int>(rp.n0_c.second)) : "?") + ":" +
(rp.n1_c.first ? details::to_str(static_cast<int>(rp.n1_c.second)) : "?") + "]",
exprtk_error_location));
@@ -24200,7 +24651,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR110 - Symbol '" + symbol+ " not a vector",
+ "ERR113 - Symbol '" + symbol+ " not a vector",
exprtk_error_location));
return error_node();
@@ -24226,7 +24677,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR111 - Failed to parse index for vector: '" + symbol + "'",
+ "ERR114 - Failed to parse index for vector: '" + symbol + "'",
exprtk_error_location));
return error_node();
@@ -24236,7 +24687,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR112 - Expected ']' for index of vector: '" + symbol + "'",
+ "ERR115 - Expected ']' for index of vector: '" + symbol + "'",
exprtk_error_location));
free_node(node_allocator_,index_expr);
@@ -24255,7 +24706,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR113 - Index of " + details::to_str(index) + " out of range for "
+ "ERR116 - Index of " + details::to_str(index) + " out of range for "
"vector '" + symbol + "' of size " + details::to_str(vec_size),
exprtk_error_location));
@@ -24287,7 +24738,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR114 - Zero parameter call to vararg function: "
+ "ERR117 - Zero parameter call to vararg function: "
+ vararg_function_name + " not allowed",
exprtk_error_location));
@@ -24312,7 +24763,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR115 - Expected ',' for call to vararg function: "
+ "ERR118 - Expected ',' for call to vararg function: "
+ vararg_function_name,
exprtk_error_location));
@@ -24326,7 +24777,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR116 - Zero parameter call to vararg function: "
+ "ERR119 - Zero parameter call to vararg function: "
+ vararg_function_name + " not allowed",
exprtk_error_location));
@@ -24338,7 +24789,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR117 - Invalid number of parameters to call to vararg function: "
+ "ERR120 - Invalid number of parameters to call to vararg function: "
+ vararg_function_name + ", require at least "
+ details::to_str(static_cast<int>(vararg_function->min_num_args())) + " parameters",
exprtk_error_location));
@@ -24350,7 +24801,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR118 - Invalid number of parameters to call to vararg function: "
+ "ERR121 - Invalid number of parameters to call to vararg function: "
+ vararg_function_name + ", require no more than "
+ details::to_str(static_cast<int>(vararg_function->max_num_args())) + " parameters",
exprtk_error_location));
@@ -24389,19 +24840,14 @@
const std::string& func_name,
const std::string& func_prototypes,
const return_type_t default_return_type)
- : invalid_state_(true),
- parser_(p),
- function_name_(func_name),
- default_return_type_(default_return_type)
+ : invalid_state_(true)
+ , parser_(p)
+ , function_name_(func_name)
+ , default_return_type_(default_return_type)
{
parse_function_prototypes(func_prototypes);
}
- void set_default_return_type(const std::string& return_type)
- {
- default_return_type_ = return_type;
- }
-
bool verify(const std::string& param_seq, std::size_t& pseq_index)
{
if (function_definition_list_.empty())
@@ -24433,9 +24879,9 @@
set_error(
make_error(parser_error::e_syntax,
parser_.current_token(),
- "ERR119 - Failed parameter type check for function '" + function_name_ + "', "
+ "ERR122 - Failed parameter type check for function '" + function_name_ + "', "
"Expected '" + function_definition_list_[0].param_seq +
- "' call set: '" + param_seq + "'",
+ "' call set: '" + param_seq + "'",
exprtk_error_location));
}
else
@@ -24455,9 +24901,9 @@
set_error(
make_error(parser_error::e_syntax,
parser_.current_token(),
- "ERR120 - Failed parameter type check for function '" + function_name_ + "', "
+ "ERR123 - Failed parameter type check for function '" + function_name_ + "', "
"Best match: '" + function_definition_list_[max_diff_index].param_seq +
- "' call set: '" + param_seq + "'",
+ "' call set: '" + param_seq + "'",
exprtk_error_location));
}
@@ -24597,7 +25043,7 @@
set_error(
make_error(parser_error::e_syntax,
parser_.current_token(),
- "ERR121 - Invalid parameter sequence of '" + param_seq_list[i] +
+ "ERR124 - Invalid parameter sequence of '" + param_seq_list[i] +
"' for function: " + function_name_,
exprtk_error_location));
return;
@@ -24613,7 +25059,7 @@
set_error(
make_error(parser_error::e_syntax,
parser_.current_token(),
- "ERR122 - Function '" + function_name_ + "' has a parameter sequence conflict between " +
+ "ERR125 - Function '" + function_name_ + "' has a parameter sequence conflict between " +
"pseq_idx[" + details::to_str(seq_itr->second) + "] and" +
"pseq_idx[" + details::to_str(i) + "] " +
"param seq: " + param_seq_list[i],
@@ -24625,8 +25071,8 @@
}
}
- type_checker(const type_checker&);
- type_checker& operator=(const type_checker&);
+ type_checker(const type_checker&) exprtk_delete;
+ type_checker& operator=(const type_checker&) exprtk_delete;
bool invalid_state_;
parser_t& parser_;
@@ -24652,7 +25098,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR123 - Type checker instantiation failure for generic function: " + function_name,
+ "ERR126 - Type checker instantiation failure for generic function: " + function_name,
exprtk_error_location));
return error_node();
@@ -24670,7 +25116,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR124 - Zero parameter call to generic function: "
+ "ERR127 - Zero parameter call to generic function: "
+ function_name + " not allowed",
exprtk_error_location));
@@ -24702,7 +25148,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR125 - Expected ',' for call to generic function: " + function_name,
+ "ERR128 - Expected ',' for call to generic function: " + function_name,
exprtk_error_location));
return error_node();
@@ -24719,7 +25165,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR126 - Zero parameter call to generic function: "
+ "ERR129 - Zero parameter call to generic function: "
+ function_name + " not allowed",
exprtk_error_location));
@@ -24736,7 +25182,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR127 - Invalid input parameter sequence for call to generic function: " + function_name,
+ "ERR130 - Invalid input parameter sequence for call to generic function: " + function_name,
exprtk_error_location));
return error_node();
@@ -24774,7 +25220,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR128 - Zero parameter call to generic function: "
+ "ERR131 - Zero parameter call to generic function: "
+ function_name + " not allowed",
exprtk_error_location));
@@ -24806,7 +25252,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR129 - Expected ',' for call to string function: " + function_name,
+ "ERR132 - Expected ',' for call to string function: " + function_name,
exprtk_error_location));
return false;
@@ -24853,7 +25299,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR130 - Invalid input parameter sequence for call to string function: " + function_name,
+ "ERR133 - Invalid input parameter sequence for call to string function: " + function_name,
exprtk_error_location));
return error_node();
@@ -24905,7 +25351,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR131 - Invalid input parameter sequence for call to overloaded function: " + function_name,
+ "ERR134 - Invalid input parameter sequence for call to overloaded function: " + function_name,
exprtk_error_location));
return error_node();
@@ -24936,7 +25382,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR132 - Invalid return type for call to overloaded function: " + function_name,
+ "ERR135 - Invalid return type for call to overloaded function: " + function_name,
exprtk_error_location));
}
@@ -24964,7 +25410,7 @@
p.set_error(
make_error(parser_error::e_syntax,
p.current_token(),
- "ERR133 - Expected '(' for special function '" + sf_name + "'",
+ "ERR136 - Expected '(' for special function '" + sf_name + "'",
exprtk_error_location));
return error_node();
@@ -24985,7 +25431,7 @@
p.set_error(
make_error(parser_error::e_syntax,
p.current_token(),
- "ERR134 - Expected ',' before next parameter of special function '" + sf_name + "'",
+ "ERR137 - Expected ',' before next parameter of special function '" + sf_name + "'",
exprtk_error_location));
return p.error_node();
@@ -24998,7 +25444,7 @@
p.set_error(
make_error(parser_error::e_syntax,
p.current_token(),
- "ERR135 - Invalid number of parameters for special function '" + sf_name + "'",
+ "ERR138 - Invalid number of parameters for special function '" + sf_name + "'",
exprtk_error_location));
return p.error_node();
@@ -25025,7 +25471,7 @@
set_error(
make_error(parser_error::e_token,
current_token(),
- "ERR136 - Invalid special function[1]: " + sf_name,
+ "ERR139 - Invalid special function[1]: " + sf_name,
exprtk_error_location));
return error_node();
@@ -25039,7 +25485,7 @@
set_error(
make_error(parser_error::e_token,
current_token(),
- "ERR137 - Invalid special function[2]: " + sf_name,
+ "ERR140 - Invalid special function[2]: " + sf_name,
exprtk_error_location));
return error_node();
@@ -25071,7 +25517,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR138 - Invoking 'break' within a break call is not allowed",
+ "ERR141 - Invoking 'break' within a break call is not allowed",
exprtk_error_location));
return error_node();
@@ -25081,7 +25527,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR139 - Invalid use of 'break', allowed only in the scope of a loop",
+ "ERR142 - Invalid use of 'break', allowed only in the scope of a loop",
exprtk_error_location));
return error_node();
@@ -25104,7 +25550,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR140 - Failed to parse return expression for 'break' statement",
+ "ERR143 - Failed to parse return expression for 'break' statement",
exprtk_error_location));
return error_node();
@@ -25114,7 +25560,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR141 - Expected ']' at the completion of break's return expression",
+ "ERR144 - Expected ']' at the completion of break's return expression",
exprtk_error_location));
free_node(node_allocator_,return_expr);
@@ -25132,7 +25578,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR142 - Invalid use of 'break', allowed only in the scope of a loop",
+ "ERR145 - Invalid use of 'break', allowed only in the scope of a loop",
exprtk_error_location));
}
@@ -25146,7 +25592,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR143 - Invalid use of 'continue', allowed only in the scope of a loop",
+ "ERR146 - Invalid use of 'continue', allowed only in the scope of a loop",
exprtk_error_location));
return error_node();
@@ -25172,7 +25618,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR144 - Expected '[' as part of vector size definition",
+ "ERR147 - Expected '[' as part of vector size definition",
exprtk_error_location));
return error_node();
@@ -25182,7 +25628,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR145 - Failed to determine size of vector '" + vec_name + "'",
+ "ERR148 - Failed to determine size of vector '" + vec_name + "'",
exprtk_error_location));
return error_node();
@@ -25194,7 +25640,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR146 - Expected a literal number as size of vector '" + vec_name + "'",
+ "ERR149 - Expected a literal number as size of vector '" + vec_name + "'",
exprtk_error_location));
return error_node();
@@ -25216,7 +25662,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR147 - Invalid vector size. Must be an integer in the range [0,2e9], size: " +
+ "ERR150 - Invalid vector size. Must be an integer in the range [0,2e9], size: " +
details::to_str(details::numeric::to_int32(vector_size)),
exprtk_error_location));
@@ -25236,7 +25682,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR148 - Expected ']' as part of vector size definition",
+ "ERR151 - Expected ']' as part of vector size definition",
exprtk_error_location));
return error_node();
@@ -25248,7 +25694,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR149 - Expected ':=' as part of vector definition",
+ "ERR152 - Expected ':=' as part of vector definition",
exprtk_error_location));
return error_node();
@@ -25262,7 +25708,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR150 - Failed to parse single vector initialiser",
+ "ERR153 - Failed to parse single vector initialiser",
exprtk_error_location));
return error_node();
@@ -25275,7 +25721,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR151 - Expected ']' to close single value vector initialiser",
+ "ERR154 - Expected ']' to close single value vector initialiser",
exprtk_error_location));
return error_node();
@@ -25322,7 +25768,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR152 - Expected '{' as part of vector initialiser list",
+ "ERR155 - Expected '{' as part of vector initialiser list",
exprtk_error_location));
return error_node();
@@ -25342,7 +25788,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR153 - Expected '{' as part of vector initialiser list",
+ "ERR156 - Expected '{' as part of vector initialiser list",
exprtk_error_location));
return error_node();
@@ -25360,7 +25806,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR154 - Expected ',' between vector initialisers",
+ "ERR157 - Expected ',' between vector initialisers",
exprtk_error_location));
return error_node();
@@ -25382,7 +25828,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR155 - Expected ';' at end of vector definition",
+ "ERR158 - Expected ';' at end of vector definition",
exprtk_error_location));
return error_node();
@@ -25394,7 +25840,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR156 - Initialiser list larger than the number of elements in the vector: '" + vec_name + "'",
+ "ERR159 - Initialiser list larger than the number of elements in the vector: '" + vec_name + "'",
exprtk_error_location));
return error_node();
@@ -25414,7 +25860,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR157 - Illegal redefinition of local vector: '" + vec_name + "'",
+ "ERR160 - Illegal redefinition of local vector: '" + vec_name + "'",
exprtk_error_location));
return error_node();
@@ -25441,14 +25887,14 @@
nse.depth = state_.scope_depth;
nse.size = vec_size;
nse.data = new T[vec_size];
- nse.vec_node = new typename scope_element::vector_holder_t((T*)(nse.data),nse.size);
+ nse.vec_node = new typename scope_element::vector_holder_t(reinterpret_cast<T*>(nse.data),nse.size);
if (!sem_.add_element(nse))
{
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR158 - Failed to add new local vector '" + vec_name + "' to SEM",
+ "ERR161 - Failed to add new local vector '" + vec_name + "' to SEM",
exprtk_error_location));
sem_.free_element(nse);
@@ -25507,7 +25953,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR159 - Illegal redefinition of local variable: '" + str_name + "'",
+ "ERR162 - Illegal redefinition of local variable: '" + str_name + "'",
exprtk_error_location));
free_node(node_allocator_,initialisation_expression);
@@ -25532,14 +25978,14 @@
nse.type = scope_element::e_string;
nse.depth = state_.scope_depth;
nse.data = new std::string;
- nse.str_node = new stringvar_node_t(*(std::string*)(nse.data));
+ nse.str_node = new stringvar_node_t(*reinterpret_cast<std::string*>(nse.data));
if (!sem_.add_element(nse))
{
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR160 - Failed to add new local string variable '" + str_name + "' to SEM",
+ "ERR163 - Failed to add new local string variable '" + str_name + "' to SEM",
exprtk_error_location));
free_node(node_allocator_,initialisation_expression);
@@ -25585,7 +26031,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR161 - Illegal variable definition",
+ "ERR164 - Illegal variable definition",
exprtk_error_location));
return error_node();
@@ -25606,7 +26052,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR162 - Expected a symbol for variable definition",
+ "ERR165 - Expected a symbol for variable definition",
exprtk_error_location));
return error_node();
@@ -25616,7 +26062,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR163 - Illegal redefinition of reserved keyword: '" + var_name + "'",
+ "ERR166 - Illegal redefinition of reserved keyword: '" + var_name + "'",
exprtk_error_location));
return error_node();
@@ -25626,7 +26072,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR164 - Illegal redefinition of variable '" + var_name + "'",
+ "ERR167 - Illegal redefinition of variable '" + var_name + "'",
exprtk_error_location));
return error_node();
@@ -25636,7 +26082,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR165 - Illegal redefinition of local variable: '" + var_name + "'",
+ "ERR168 - Illegal redefinition of local variable: '" + var_name + "'",
exprtk_error_location));
return error_node();
@@ -25656,7 +26102,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR166 - Failed to parse initialisation expression",
+ "ERR169 - Failed to parse initialisation expression",
exprtk_error_location));
return error_node();
@@ -25674,7 +26120,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR167 - Expected ';' after variable definition",
+ "ERR170 - Expected ';' after variable definition",
exprtk_error_location));
free_node(node_allocator_,initialisation_expression);
@@ -25702,7 +26148,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR168 - Illegal redefinition of local variable: '" + var_name + "'",
+ "ERR171 - Illegal redefinition of local variable: '" + var_name + "'",
exprtk_error_location));
free_node(node_allocator_, initialisation_expression);
@@ -25727,14 +26173,14 @@
nse.type = scope_element::e_variable;
nse.depth = state_.scope_depth;
nse.data = new T(T(0));
- nse.var_node = node_allocator_.allocate<variable_node_t>(*(T*)(nse.data));
+ nse.var_node = node_allocator_.allocate<variable_node_t>(*reinterpret_cast<T*>(nse.data));
if (!sem_.add_element(nse))
{
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR169 - Failed to add new local variable '" + var_name + "' to SEM",
+ "ERR172 - Failed to add new local variable '" + var_name + "' to SEM",
exprtk_error_location));
free_node(node_allocator_, initialisation_expression);
@@ -25771,7 +26217,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR170 - Expected a '{}' for uninitialised var definition",
+ "ERR173 - Expected a '{}' for uninitialised var definition",
exprtk_error_location));
return error_node();
@@ -25781,7 +26227,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR171 - Expected ';' after uninitialised variable definition",
+ "ERR174 - Expected ';' after uninitialised variable definition",
exprtk_error_location));
return error_node();
@@ -25798,7 +26244,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR172 - Illegal redefinition of local variable: '" + var_name + "'",
+ "ERR175 - Illegal redefinition of local variable: '" + var_name + "'",
exprtk_error_location));
return error_node();
@@ -25821,14 +26267,14 @@
nse.depth = state_.scope_depth;
nse.ip_index = sem_.next_ip_index();
nse.data = new T(T(0));
- nse.var_node = node_allocator_.allocate<variable_node_t>(*(T*)(nse.data));
+ nse.var_node = node_allocator_.allocate<variable_node_t>(*reinterpret_cast<T*>(nse.data));
if (!sem_.add_element(nse))
{
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR173 - Failed to add new local variable '" + var_name + "' to SEM",
+ "ERR176 - Failed to add new local variable '" + var_name + "' to SEM",
exprtk_error_location));
sem_.free_element(nse);
@@ -25861,7 +26307,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR174 - Expected '(' at start of swap statement",
+ "ERR177 - Expected '(' at start of swap statement",
exprtk_error_location));
return error_node();
@@ -25880,7 +26326,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR175 - Expected a symbol for variable or vector element definition",
+ "ERR178 - Expected a symbol for variable or vector element definition",
exprtk_error_location));
return error_node();
@@ -25892,7 +26338,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR176 - First parameter to swap is an invalid vector element: '" + var0_name + "'",
+ "ERR179 - First parameter to swap is an invalid vector element: '" + var0_name + "'",
exprtk_error_location));
return error_node();
@@ -25925,7 +26371,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR177 - First parameter to swap is an invalid variable: '" + var0_name + "'",
+ "ERR180 - First parameter to swap is an invalid variable: '" + var0_name + "'",
exprtk_error_location));
return error_node();
@@ -25939,7 +26385,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR178 - Expected ',' between parameters to swap",
+ "ERR181 - Expected ',' between parameters to swap",
exprtk_error_location));
if (variable0_generated)
@@ -25957,7 +26403,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR179 - Expected a symbol for variable or vector element definition",
+ "ERR182 - Expected a symbol for variable or vector element definition",
exprtk_error_location));
if (variable0_generated)
@@ -25974,7 +26420,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR180 - Second parameter to swap is an invalid vector element: '" + var1_name + "'",
+ "ERR183 - Second parameter to swap is an invalid vector element: '" + var1_name + "'",
exprtk_error_location));
if (variable0_generated)
@@ -26012,7 +26458,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR181 - Second parameter to swap is an invalid variable: '" + var1_name + "'",
+ "ERR184 - Second parameter to swap is an invalid variable: '" + var1_name + "'",
exprtk_error_location));
if (variable0_generated)
@@ -26031,7 +26477,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR182 - Expected ')' at end of swap statement",
+ "ERR185 - Expected ')' at end of swap statement",
exprtk_error_location));
if (variable0_generated)
@@ -26088,7 +26534,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR183 - Return call within a return call is not allowed",
+ "ERR186 - Return call within a return call is not allowed",
exprtk_error_location));
return error_node();
@@ -26112,7 +26558,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR184 - Expected '[' at start of return statement",
+ "ERR187 - Expected '[' at start of return statement",
exprtk_error_location));
return error_node();
@@ -26135,7 +26581,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR185 - Expected ',' between values during call to return",
+ "ERR188 - Expected ',' between values during call to return",
exprtk_error_location));
return error_node();
@@ -26147,7 +26593,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR186 - Zero parameter return statement not allowed",
+ "ERR189 - Zero parameter return statement not allowed",
exprtk_error_location));
return error_node();
@@ -26162,7 +26608,7 @@
set_error(
make_error(parser_error::e_syntax,
prev_token,
- "ERR187 - Invalid ']' found during return call",
+ "ERR190 - Invalid ']' found during return call",
exprtk_error_location));
return error_node();
@@ -26215,7 +26661,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR188 - Invalid sequence of variable '"+ symbol + "' and bracket",
+ "ERR191 - Invalid sequence of variable '"+ symbol + "' and bracket",
exprtk_error_location));
return false;
@@ -26231,7 +26677,7 @@
{
bool implied_mul = false;
- if (is_generally_string_node(branch))
+ if (details::is_generally_string_node(branch))
return true;
const lexer::parser_helper::token_advance_mode hold = prsrhlpr_t::e_hold;
@@ -26263,7 +26709,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR189 - Invalid sequence of brackets",
+ "ERR192 - Invalid sequence of brackets",
exprtk_error_location));
return false;
@@ -26360,7 +26806,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR190 - Failed to generate node for function: '" + symbol + "'",
+ "ERR193 - Failed to generate node for function: '" + symbol + "'",
exprtk_error_location));
return error_node();
@@ -26386,7 +26832,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR191 - Failed to generate node for vararg function: '" + symbol + "'",
+ "ERR194 - Failed to generate node for vararg function: '" + symbol + "'",
exprtk_error_location));
return error_node();
@@ -26412,7 +26858,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR192 - Failed to generate node for generic function: '" + symbol + "'",
+ "ERR195 - Failed to generate node for generic function: '" + symbol + "'",
exprtk_error_location));
return error_node();
@@ -26439,7 +26885,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR193 - Failed to generate node for string function: '" + symbol + "'",
+ "ERR196 - Failed to generate node for string function: '" + symbol + "'",
exprtk_error_location));
return error_node();
@@ -26465,7 +26911,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR194 - Failed to generate node for overload function: '" + symbol + "'",
+ "ERR197 - Failed to generate node for overload function: '" + symbol + "'",
exprtk_error_location));
return error_node();
@@ -26491,7 +26937,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR195 - Invalid use of reserved symbol '" + symbol + "'",
+ "ERR198 - Invalid use of reserved symbol '" + symbol + "'",
exprtk_error_location));
return error_node();
@@ -26554,7 +27000,7 @@
set_error(
make_error(parser_error::e_symtab,
current_token(),
- "ERR196 - Failed to create variable: '" + symbol + "'" +
+ "ERR199 - Failed to create variable: '" + symbol + "'" +
(error_message.empty() ? "" : " - " + error_message),
exprtk_error_location));
@@ -26574,7 +27020,7 @@
set_error(
make_error(parser_error::e_symtab,
current_token(),
- "ERR197 - Failed to resolve symbol: '" + symbol + "'" +
+ "ERR200 - Failed to resolve symbol: '" + symbol + "'" +
(error_message.empty() ? "" : " - " + error_message),
exprtk_error_location));
}
@@ -26586,7 +27032,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR198 - Undefined symbol: '" + symbol + "'",
+ "ERR201 - Undefined symbol: '" + symbol + "'",
exprtk_error_location));
return error_node();
@@ -26607,83 +27053,85 @@
static const std::string symbol_return = "return" ;
static const std::string symbol_not = "not" ;
- if (valid_vararg_operation(current_token().value))
+ const std::string symbol = current_token().value;
+
+ if (valid_vararg_operation(symbol))
{
return parse_vararg_function();
}
- else if (details::imatch(current_token().value, symbol_not))
+ else if (details::imatch(symbol, symbol_not))
{
return parse_not_statement();
}
- else if (valid_base_operation(current_token().value))
+ else if (valid_base_operation(symbol))
{
return parse_base_operation();
}
else if (
- details::imatch(current_token().value, symbol_if) &&
- settings_.control_struct_enabled(current_token().value)
+ details::imatch(symbol, symbol_if) &&
+ settings_.control_struct_enabled(symbol)
)
{
return parse_conditional_statement();
}
else if (
- details::imatch(current_token().value, symbol_while) &&
- settings_.control_struct_enabled(current_token().value)
+ details::imatch(symbol, symbol_while) &&
+ settings_.control_struct_enabled(symbol)
)
{
return parse_while_loop();
}
else if (
- details::imatch(current_token().value, symbol_repeat) &&
- settings_.control_struct_enabled(current_token().value)
+ details::imatch(symbol, symbol_repeat) &&
+ settings_.control_struct_enabled(symbol)
)
{
return parse_repeat_until_loop();
}
else if (
- details::imatch(current_token().value, symbol_for) &&
- settings_.control_struct_enabled(current_token().value)
+ details::imatch(symbol, symbol_for) &&
+ settings_.control_struct_enabled(symbol)
)
{
return parse_for_loop();
}
else if (
- details::imatch(current_token().value, symbol_switch) &&
- settings_.control_struct_enabled(current_token().value)
+ details::imatch(symbol, symbol_switch) &&
+ settings_.control_struct_enabled(symbol)
)
{
return parse_switch_statement();
}
- else if (details::is_valid_sf_symbol(current_token().value))
+ else if (details::is_valid_sf_symbol(symbol))
{
return parse_special_function();
}
- else if (details::imatch(current_token().value, symbol_null))
+ else if (details::imatch(symbol, symbol_null))
{
return parse_null_statement();
}
#ifndef exprtk_disable_break_continue
- else if (details::imatch(current_token().value, symbol_break))
+ else if (details::imatch(symbol, symbol_break))
{
return parse_break_statement();
}
- else if (details::imatch(current_token().value, symbol_continue))
+ else if (details::imatch(symbol, symbol_continue))
{
return parse_continue_statement();
}
#endif
- else if (details::imatch(current_token().value, symbol_var))
+ else if (details::imatch(symbol, symbol_var))
{
return parse_define_var_statement();
}
- else if (details::imatch(current_token().value, symbol_swap))
+ else if (details::imatch(symbol, symbol_swap))
{
return parse_swap_statement();
}
#ifndef exprtk_disable_return_statement
else if (
- details::imatch(current_token().value, symbol_return) &&
- settings_.control_struct_enabled(current_token().value)
+ details::imatch(symbol, symbol_return) &&
+ settings_.control_struct_enabled(symbol)
)
{
return parse_return_statement();
@@ -26698,7 +27146,7 @@
set_error(
make_error(parser_error::e_symtab,
current_token(),
- "ERR199 - Variable or function detected, yet symbol-table is invalid, Symbol: " + current_token().value,
+ "ERR202 - Variable or function detected, yet symbol-table is invalid, Symbol: " + symbol,
exprtk_error_location));
return error_node();
@@ -26729,7 +27177,7 @@
set_error(
make_error(parser_error::e_numeric,
current_token(),
- "ERR200 - Failed generate node for scalar: '" + current_token().value + "'",
+ "ERR203 - Failed generate node for scalar: '" + current_token().value + "'",
exprtk_error_location));
return error_node();
@@ -26743,7 +27191,7 @@
set_error(
make_error(parser_error::e_numeric,
current_token(),
- "ERR201 - Failed to convert '" + current_token().value + "' to a number",
+ "ERR204 - Failed to convert '" + current_token().value + "' to a number",
exprtk_error_location));
return error_node();
@@ -26770,16 +27218,16 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR202 - Expected ')' instead of: '" + current_token().value + "'",
+ "ERR205 - Expected ')' instead of: '" + current_token().value + "'",
exprtk_error_location));
- free_node(node_allocator_,branch);
+ details::free_node(node_allocator_,branch);
return error_node();
}
else if (!post_bracket_process(token_t::e_lbracket,branch))
{
- free_node(node_allocator_,branch);
+ details::free_node(node_allocator_,branch);
return error_node();
}
@@ -26795,16 +27243,16 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR203 - Expected ']' instead of: '" + current_token().value + "'",
+ "ERR206 - Expected ']' instead of: '" + current_token().value + "'",
exprtk_error_location));
- free_node(node_allocator_,branch);
+ details::free_node(node_allocator_,branch);
return error_node();
}
else if (!post_bracket_process(token_t::e_lsqrbracket,branch))
{
- free_node(node_allocator_,branch);
+ details::free_node(node_allocator_,branch);
return error_node();
}
@@ -26820,16 +27268,16 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR204 - Expected '}' instead of: '" + current_token().value + "'",
+ "ERR207 - Expected '}' instead of: '" + current_token().value + "'",
exprtk_error_location));
- free_node(node_allocator_,branch);
+ details::free_node(node_allocator_,branch);
return error_node();
}
else if (!post_bracket_process(token_t::e_lcrlbracket,branch))
{
- free_node(node_allocator_,branch);
+ details::free_node(node_allocator_,branch);
return error_node();
}
@@ -26851,7 +27299,7 @@
if (0 == result)
{
- free_node(node_allocator_,branch);
+ details::free_node(node_allocator_,branch);
return error_node();
}
@@ -26869,7 +27317,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR205 - Premature end of expression[1]",
+ "ERR208 - Premature end of expression[1]",
exprtk_error_location));
return error_node();
@@ -26879,7 +27327,7 @@
set_error(
make_error(parser_error::e_syntax,
current_token(),
- "ERR206 - Premature end of expression[2]",
+ "ERR209 - Premature end of expression[2]",
exprtk_error_location));
return error_node();
@@ -27581,9 +28029,9 @@
(details::e_equal == operation) ||
(details::e_and == operation) ||
(details::e_nand == operation) ||
- (details:: e_or == operation) ||
- (details:: e_nor == operation) ||
- (details:: e_xor == operation) ||
+ (details::e_or == operation) ||
+ (details::e_nor == operation) ||
+ (details::e_xor == operation) ||
(details::e_xnor == operation)
);
}
@@ -27782,9 +28230,9 @@
{
if ((0 == condition) || (0 == consequent))
{
- free_node(*node_allocator_, condition);
- free_node(*node_allocator_, consequent);
- free_node(*node_allocator_, alternative);
+ details::free_node(*node_allocator_, condition );
+ details::free_node(*node_allocator_, consequent );
+ details::free_node(*node_allocator_, alternative);
return error_node();
}
@@ -27794,16 +28242,16 @@
// True branch
if (details::is_true(condition))
{
- free_node(*node_allocator_, condition);
- free_node(*node_allocator_, alternative);
+ details::free_node(*node_allocator_, condition );
+ details::free_node(*node_allocator_, alternative);
return consequent;
}
// False branch
else
{
- free_node(*node_allocator_, condition);
- free_node(*node_allocator_, consequent);
+ details::free_node(*node_allocator_, condition );
+ details::free_node(*node_allocator_, consequent);
if (alternative)
return alternative;
@@ -27828,9 +28276,9 @@
{
if ((0 == condition) || (0 == consequent))
{
- free_node(*node_allocator_, condition);
- free_node(*node_allocator_, consequent);
- free_node(*node_allocator_, alternative);
+ details::free_node(*node_allocator_, condition );
+ details::free_node(*node_allocator_, consequent );
+ details::free_node(*node_allocator_, alternative);
return error_node();
}
@@ -27840,16 +28288,16 @@
// True branch
if (details::is_true(condition))
{
- free_node(*node_allocator_, condition);
- free_node(*node_allocator_, alternative);
+ details::free_node(*node_allocator_, condition );
+ details::free_node(*node_allocator_, alternative);
return consequent;
}
// False branch
else
{
- free_node(*node_allocator_, condition);
- free_node(*node_allocator_, consequent);
+ details::free_node(*node_allocator_, condition );
+ details::free_node(*node_allocator_, consequent);
if (alternative)
return alternative;
@@ -27873,6 +28321,51 @@
}
#endif
+ inline expression_node_ptr conditional_vector(expression_node_ptr condition,
+ expression_node_ptr consequent,
+ expression_node_ptr alternative) const
+ {
+ if ((0 == condition) || (0 == consequent))
+ {
+ details::free_node(*node_allocator_, condition );
+ details::free_node(*node_allocator_, consequent );
+ details::free_node(*node_allocator_, alternative);
+
+ return error_node();
+ }
+ // Can the condition be immediately evaluated? if so optimise.
+ else if (details::is_constant_node(condition))
+ {
+ // True branch
+ if (details::is_true(condition))
+ {
+ details::free_node(*node_allocator_, condition );
+ details::free_node(*node_allocator_, alternative);
+
+ return consequent;
+ }
+ // False branch
+ else
+ {
+ details::free_node(*node_allocator_, condition );
+ details::free_node(*node_allocator_, consequent);
+
+ if (alternative)
+ return alternative;
+ else
+ return node_allocator_->allocate<details::null_node<T> >();
+
+ }
+ }
+ else if ((0 != consequent) && (0 != alternative))
+ {
+ return node_allocator_->
+ allocate<conditional_vector_node_t>(condition, consequent, alternative);
+ }
+ else
+ return error_node();
+ }
+
inline loop_runtime_check_ptr get_loop_runtime_check(const loop_runtime_check::loop_types loop_type) const
{
if (
@@ -27888,9 +28381,9 @@
inline expression_node_ptr while_loop(expression_node_ptr& condition,
expression_node_ptr& branch,
- const bool brkcont = false) const
+ const bool break_continue_present = false) const
{
- if (!brkcont && details::is_constant_node(condition))
+ if (!break_continue_present && details::is_constant_node(condition))
{
expression_node_ptr result = error_node();
if (details::is_true(condition))
@@ -27899,32 +28392,39 @@
else
result = node_allocator_->allocate<details::null_node<Type> >();
- free_node(*node_allocator_, condition);
- free_node(*node_allocator_, branch);
+ details::free_node(*node_allocator_, condition);
+ details::free_node(*node_allocator_, branch );
return result;
}
else if (details::is_null_node(condition))
{
- free_node(*node_allocator_,condition);
+ details::free_node(*node_allocator_,condition);
return branch;
}
- else if (!brkcont)
- return node_allocator_->allocate<while_loop_node_t>
- (
- condition,
- branch,
- get_loop_runtime_check(loop_runtime_check::e_while_loop)
- );
+
+ loop_runtime_check_ptr rtc = get_loop_runtime_check(loop_runtime_check::e_while_loop);
+
+ if (!break_continue_present)
+ {
+ if (rtc)
+ return node_allocator_->allocate<while_loop_rtc_node_t>
+ (condition, branch, rtc);
+ else
+ return node_allocator_->allocate<while_loop_node_t>
+ (condition, branch);
+ }
#ifndef exprtk_disable_break_continue
else
- return node_allocator_->allocate<while_loop_bc_node_t>
- (
- condition,
- branch,
- get_loop_runtime_check(loop_runtime_check::e_while_loop)
- );
+ {
+ if (rtc)
+ return node_allocator_->allocate<while_loop_bc_rtc_node_t>
+ (condition, branch, rtc);
+ else
+ return node_allocator_->allocate<while_loop_bc_node_t>
+ (condition, branch);
+ }
#else
return error_node();
#endif
@@ -27932,9 +28432,9 @@
inline expression_node_ptr repeat_until_loop(expression_node_ptr& condition,
expression_node_ptr& branch,
- const bool brkcont = false) const
+ const bool break_continue_present = false) const
{
- if (!brkcont && details::is_constant_node(condition))
+ if (!break_continue_present && details::is_constant_node(condition))
{
if (
details::is_true(condition) &&
@@ -27946,32 +28446,39 @@
return branch;
}
- free_node(*node_allocator_, condition);
- free_node(*node_allocator_, branch);
+ details::free_node(*node_allocator_, condition);
+ details::free_node(*node_allocator_, branch );
return error_node();
}
else if (details::is_null_node(condition))
{
- free_node(*node_allocator_,condition);
+ details::free_node(*node_allocator_,condition);
return branch;
}
- else if (!brkcont)
- return node_allocator_->allocate<repeat_until_loop_node_t>
- (
- condition,
- branch,
- get_loop_runtime_check(loop_runtime_check::e_repeat_until_loop)
- );
+
+ loop_runtime_check_ptr rtc = get_loop_runtime_check(loop_runtime_check::e_repeat_until_loop);
+
+ if (!break_continue_present)
+ {
+ if (rtc)
+ return node_allocator_->allocate<repeat_until_loop_rtc_node_t>
+ (condition, branch, rtc);
+ else
+ return node_allocator_->allocate<repeat_until_loop_node_t>
+ (condition, branch);
+ }
#ifndef exprtk_disable_break_continue
else
- return node_allocator_->allocate<repeat_until_loop_bc_node_t>
- (
- condition,
- branch,
- get_loop_runtime_check(loop_runtime_check::e_repeat_until_loop)
- );
+ {
+ if (rtc)
+ return node_allocator_->allocate<repeat_until_loop_bc_rtc_node_t>
+ (condition, branch, rtc);
+ else
+ return node_allocator_->allocate<repeat_until_loop_bc_node_t>
+ (condition, branch);
+ }
#else
return error_node();
#endif
@@ -27981,9 +28488,9 @@
expression_node_ptr& condition,
expression_node_ptr& incrementor,
expression_node_ptr& loop_body,
- bool brkcont = false) const
+ bool break_continue_present = false) const
{
- if (!brkcont && details::is_constant_node(condition))
+ if (!break_continue_present && details::is_constant_node(condition))
{
expression_node_ptr result = error_node();
@@ -27993,43 +28500,67 @@
else
result = node_allocator_->allocate<details::null_node<Type> >();
- free_node(*node_allocator_, initialiser);
- free_node(*node_allocator_, condition);
- free_node(*node_allocator_, incrementor);
- free_node(*node_allocator_, loop_body);
+ details::free_node(*node_allocator_, initialiser);
+ details::free_node(*node_allocator_, condition );
+ details::free_node(*node_allocator_, incrementor);
+ details::free_node(*node_allocator_, loop_body );
return result;
}
else if (details::is_null_node(condition) || (0 == condition))
{
- free_node(*node_allocator_, initialiser);
- free_node(*node_allocator_, condition);
- free_node(*node_allocator_, incrementor);
+ details::free_node(*node_allocator_, initialiser);
+ details::free_node(*node_allocator_, condition );
+ details::free_node(*node_allocator_, incrementor);
return loop_body;
}
- else if (!brkcont)
- return node_allocator_->allocate<for_loop_node_t>
- (
- initialiser,
- condition,
- incrementor,
- loop_body,
- get_loop_runtime_check(loop_runtime_check::e_for_loop)
- );
+ loop_runtime_check_ptr rtc = get_loop_runtime_check(loop_runtime_check::e_for_loop);
+
+ if (!break_continue_present)
+ {
+ if (rtc)
+ return node_allocator_->allocate<for_loop_rtc_node_t>
+ (
+ initialiser,
+ condition,
+ incrementor,
+ loop_body,
+ rtc
+ );
+ else
+ return node_allocator_->allocate<for_loop_node_t>
+ (
+ initialiser,
+ condition,
+ incrementor,
+ loop_body
+ );
+ }
#ifndef exprtk_disable_break_continue
else
- return node_allocator_->allocate<for_loop_bc_node_t>
- (
- initialiser,
- condition,
- incrementor,
- loop_body,
- get_loop_runtime_check(loop_runtime_check::e_for_loop)
- );
+ {
+ if (rtc)
+ return node_allocator_->allocate<for_loop_bc_rtc_node_t>
+ (
+ initialiser,
+ condition,
+ incrementor,
+ loop_body,
+ rtc
+ );
+ else
+ return node_allocator_->allocate<for_loop_bc_node_t>
+ (
+ initialiser,
+ condition,
+ incrementor,
+ loop_body
+ );
+ }
#else
- return error_node();
+ return error_node();
#endif
}
@@ -28098,7 +28629,7 @@
if (current_expr && (current_expr != result))
{
- free_node(*node_allocator_,current_expr);
+ details::free_node(*node_allocator_,current_expr);
}
}
@@ -28112,49 +28643,57 @@
#define case_stmt(N) \
if (is_true(arg[(2 * N)].first)) { return arg[(2 * N) + 1].first->value(); } \
- struct switch_1
+ struct switch_impl_1
{
static inline T process(const arg_list_t& arg)
{
case_stmt(0)
+ assert(arg.size() == ((2 * 1) + 1));
+
return arg.back().first->value();
}
};
- struct switch_2
+ struct switch_impl_2
{
static inline T process(const arg_list_t& arg)
{
case_stmt(0) case_stmt(1)
+ assert(arg.size() == ((2 * 2) + 1));
+
return arg.back().first->value();
}
};
- struct switch_3
+ struct switch_impl_3
{
static inline T process(const arg_list_t& arg)
{
case_stmt(0) case_stmt(1)
case_stmt(2)
+ assert(arg.size() == ((2 * 3) + 1));
+
return arg.back().first->value();
}
};
- struct switch_4
+ struct switch_impl_4
{
static inline T process(const arg_list_t& arg)
{
case_stmt(0) case_stmt(1)
case_stmt(2) case_stmt(3)
+ assert(arg.size() == ((2 * 4) + 1));
+
return arg.back().first->value();
}
};
- struct switch_5
+ struct switch_impl_5
{
static inline T process(const arg_list_t& arg)
{
@@ -28162,11 +28701,13 @@
case_stmt(2) case_stmt(3)
case_stmt(4)
+ assert(arg.size() == ((2 * 5) + 1));
+
return arg.back().first->value();
}
};
- struct switch_6
+ struct switch_impl_6
{
static inline T process(const arg_list_t& arg)
{
@@ -28174,11 +28715,13 @@
case_stmt(2) case_stmt(3)
case_stmt(4) case_stmt(5)
+ assert(arg.size() == ((2 * 6) + 1));
+
return arg.back().first->value();
}
};
- struct switch_7
+ struct switch_impl_7
{
static inline T process(const arg_list_t& arg)
{
@@ -28187,6 +28730,8 @@
case_stmt(4) case_stmt(5)
case_stmt(6)
+ assert(arg.size() == ((2 * 7) + 1));
+
return arg.back().first->value();
}
};
@@ -28214,11 +28759,11 @@
switch ((arg_list.size() - 1) / 2)
{
- #define case_stmt(N) \
- case N : \
- return node_allocator_-> \
- allocate<details::switch_n_node \
- <Type,typename switch_nodes::switch_##N> >(arg_list); \
+ #define case_stmt(N) \
+ case N : \
+ return node_allocator_-> \
+ allocate<details::switch_n_node \
+ <Type,typename switch_nodes::switch_impl_##N > >(arg_list); \
case_stmt(1)
case_stmt(2)
@@ -28249,47 +28794,47 @@
return node_allocator_->allocate<details::multi_switch_node<Type> >(arg_list);
}
- #define unary_opr_switch_statements \
- case_stmt(details:: e_abs, details:: abs_op) \
- case_stmt(details:: e_acos, details:: acos_op) \
- case_stmt(details::e_acosh, details::acosh_op) \
- case_stmt(details:: e_asin, details:: asin_op) \
- case_stmt(details::e_asinh, details::asinh_op) \
- case_stmt(details:: e_atan, details:: atan_op) \
- case_stmt(details::e_atanh, details::atanh_op) \
- case_stmt(details:: e_ceil, details:: ceil_op) \
- case_stmt(details:: e_cos, details:: cos_op) \
- case_stmt(details:: e_cosh, details:: cosh_op) \
- case_stmt(details:: e_exp, details:: exp_op) \
- case_stmt(details::e_expm1, details::expm1_op) \
- case_stmt(details::e_floor, details::floor_op) \
- case_stmt(details:: e_log, details:: log_op) \
- case_stmt(details::e_log10, details::log10_op) \
- case_stmt(details:: e_log2, details:: log2_op) \
- case_stmt(details::e_log1p, details::log1p_op) \
- case_stmt(details:: e_neg, details:: neg_op) \
- case_stmt(details:: e_pos, details:: pos_op) \
- case_stmt(details::e_round, details::round_op) \
- case_stmt(details:: e_sin, details:: sin_op) \
- case_stmt(details:: e_sinc, details:: sinc_op) \
- case_stmt(details:: e_sinh, details:: sinh_op) \
- case_stmt(details:: e_sqrt, details:: sqrt_op) \
- case_stmt(details:: e_tan, details:: tan_op) \
- case_stmt(details:: e_tanh, details:: tanh_op) \
- case_stmt(details:: e_cot, details:: cot_op) \
- case_stmt(details:: e_sec, details:: sec_op) \
- case_stmt(details:: e_csc, details:: csc_op) \
- case_stmt(details:: e_r2d, details:: r2d_op) \
- case_stmt(details:: e_d2r, details:: d2r_op) \
- case_stmt(details:: e_d2g, details:: d2g_op) \
- case_stmt(details:: e_g2d, details:: g2d_op) \
- case_stmt(details:: e_notl, details:: notl_op) \
- case_stmt(details:: e_sgn, details:: sgn_op) \
- case_stmt(details:: e_erf, details:: erf_op) \
- case_stmt(details:: e_erfc, details:: erfc_op) \
- case_stmt(details:: e_ncdf, details:: ncdf_op) \
- case_stmt(details:: e_frac, details:: frac_op) \
- case_stmt(details::e_trunc, details::trunc_op) \
+ #define unary_opr_switch_statements \
+ case_stmt(details::e_abs , details::abs_op ) \
+ case_stmt(details::e_acos , details::acos_op ) \
+ case_stmt(details::e_acosh , details::acosh_op) \
+ case_stmt(details::e_asin , details::asin_op ) \
+ case_stmt(details::e_asinh , details::asinh_op) \
+ case_stmt(details::e_atan , details::atan_op ) \
+ case_stmt(details::e_atanh , details::atanh_op) \
+ case_stmt(details::e_ceil , details::ceil_op ) \
+ case_stmt(details::e_cos , details::cos_op ) \
+ case_stmt(details::e_cosh , details::cosh_op ) \
+ case_stmt(details::e_exp , details::exp_op ) \
+ case_stmt(details::e_expm1 , details::expm1_op) \
+ case_stmt(details::e_floor , details::floor_op) \
+ case_stmt(details::e_log , details::log_op ) \
+ case_stmt(details::e_log10 , details::log10_op) \
+ case_stmt(details::e_log2 , details::log2_op ) \
+ case_stmt(details::e_log1p , details::log1p_op) \
+ case_stmt(details::e_neg , details::neg_op ) \
+ case_stmt(details::e_pos , details::pos_op ) \
+ case_stmt(details::e_round , details::round_op) \
+ case_stmt(details::e_sin , details::sin_op ) \
+ case_stmt(details::e_sinc , details::sinc_op ) \
+ case_stmt(details::e_sinh , details::sinh_op ) \
+ case_stmt(details::e_sqrt , details::sqrt_op ) \
+ case_stmt(details::e_tan , details::tan_op ) \
+ case_stmt(details::e_tanh , details::tanh_op ) \
+ case_stmt(details::e_cot , details::cot_op ) \
+ case_stmt(details::e_sec , details::sec_op ) \
+ case_stmt(details::e_csc , details::csc_op ) \
+ case_stmt(details::e_r2d , details::r2d_op ) \
+ case_stmt(details::e_d2r , details::d2r_op ) \
+ case_stmt(details::e_d2g , details::d2g_op ) \
+ case_stmt(details::e_g2d , details::g2d_op ) \
+ case_stmt(details::e_notl , details::notl_op ) \
+ case_stmt(details::e_sgn , details::sgn_op ) \
+ case_stmt(details::e_erf , details::erf_op ) \
+ case_stmt(details::e_erfc , details::erfc_op ) \
+ case_stmt(details::e_ncdf , details::ncdf_op ) \
+ case_stmt(details::e_frac , details::frac_op ) \
+ case_stmt(details::e_trunc , details::trunc_op) \
inline expression_node_ptr synthesize_uv_expression(const details::operator_type& operation,
expression_node_ptr (&branch)[1])
@@ -28298,7 +28843,7 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
allocate<typename details::unary_variable_node<Type,op1<Type> > >(v); \
@@ -28313,7 +28858,7 @@
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
allocate<typename details::unary_vector_node<Type,op1<Type> > > \
(operation, branch[0]); \
@@ -28329,7 +28874,7 @@
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
allocate<typename details::unary_branch_node<Type,op1<Type> > >(branch[0]); \
@@ -28553,7 +29098,7 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : temp_node = node_allocator_-> \
allocate<details::vararg_node<Type,op1<Type> > > \
(arg_list); \
@@ -28595,7 +29140,7 @@
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
allocate<details::vararg_varnode<Type,op1<Type> > >(arg_list); \
@@ -28620,7 +29165,7 @@
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
allocate<details::vectorize_node<Type,op1<Type> > >(arg_list[0]); \
@@ -28667,7 +29212,7 @@
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
allocate<details::vararg_node<Type,op1<Type> > >(arg_list); \
@@ -28699,24 +29244,31 @@
if (details::is_constant_node(result))
return result;
else if (!all_nodes_valid(b))
+ {
+ details::free_node(*node_allocator_,result);
+ std::fill_n(b, N, reinterpret_cast<expression_node_ptr>(0));
+
return error_node();
+ }
else if (N != f->param_count)
{
- details::free_all_nodes(*node_allocator_,b);
+ details::free_node(*node_allocator_,result);
+ std::fill_n(b, N, reinterpret_cast<expression_node_ptr>(0));
return error_node();
}
- function_N_node_t* func_node_ptr = static_cast<function_N_node_t*>(result);
+ function_N_node_t* func_node_ptr = reinterpret_cast<function_N_node_t*>(result);
- if (func_node_ptr->init_branches(b))
- return result;
- else
+ if (!func_node_ptr->init_branches(b))
{
- details::free_all_nodes(*node_allocator_,b);
+ details::free_node(*node_allocator_,result);
+ std::fill_n(b, N, reinterpret_cast<expression_node_ptr>(0));
return error_node();
}
+
+ return result;
}
}
@@ -28889,8 +29441,8 @@
}
else
{
- details::free_node (*node_allocator_,result );
- details::free_all_nodes(*node_allocator_,arg_list);
+ details::free_node (*node_allocator_, result );
+ details::free_all_nodes(*node_allocator_, arg_list);
return error_node();
}
@@ -29110,7 +29662,7 @@
if (details::is_ivector_node(branch[1]))
return synthesize_expression<assignment_vecvec_node_t,2>(operation, branch);
- else
+ else
return synthesize_expression<assignment_vec_node_t,2>(operation, branch);
}
else
@@ -29130,16 +29682,16 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::assignment_op_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
- case_stmt(details::e_addass,details::add_op)
- case_stmt(details::e_subass,details::sub_op)
- case_stmt(details::e_mulass,details::mul_op)
- case_stmt(details::e_divass,details::div_op)
- case_stmt(details::e_modass,details::mod_op)
+ case_stmt(details::e_addass , details::add_op)
+ case_stmt(details::e_subass , details::sub_op)
+ case_stmt(details::e_mulass , details::mul_op)
+ case_stmt(details::e_divass , details::div_op)
+ case_stmt(details::e_modass , details::mod_op)
#undef case_stmt
default : return error_node();
}
@@ -29150,16 +29702,16 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::assignment_vec_elem_op_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
- case_stmt(details::e_addass,details::add_op)
- case_stmt(details::e_subass,details::sub_op)
- case_stmt(details::e_mulass,details::mul_op)
- case_stmt(details::e_divass,details::div_op)
- case_stmt(details::e_modass,details::mod_op)
+ case_stmt(details::e_addass , details::add_op)
+ case_stmt(details::e_subass , details::sub_op)
+ case_stmt(details::e_mulass , details::mul_op)
+ case_stmt(details::e_divass , details::div_op)
+ case_stmt(details::e_modass , details::mod_op)
#undef case_stmt
default : return error_node();
}
@@ -29170,16 +29722,16 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::assignment_rebasevec_elem_op_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
- case_stmt(details::e_addass,details::add_op)
- case_stmt(details::e_subass,details::sub_op)
- case_stmt(details::e_mulass,details::mul_op)
- case_stmt(details::e_divass,details::div_op)
- case_stmt(details::e_modass,details::mod_op)
+ case_stmt(details::e_addass , details::add_op)
+ case_stmt(details::e_subass , details::sub_op)
+ case_stmt(details::e_mulass , details::mul_op)
+ case_stmt(details::e_divass , details::div_op)
+ case_stmt(details::e_modass , details::mod_op)
#undef case_stmt
default : return error_node();
}
@@ -29190,16 +29742,16 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::assignment_rebasevec_celem_op_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
- case_stmt(details::e_addass,details::add_op)
- case_stmt(details::e_subass,details::sub_op)
- case_stmt(details::e_mulass,details::mul_op)
- case_stmt(details::e_divass,details::div_op)
- case_stmt(details::e_modass,details::mod_op)
+ case_stmt(details::e_addass , details::add_op)
+ case_stmt(details::e_subass , details::sub_op)
+ case_stmt(details::e_mulass , details::mul_op)
+ case_stmt(details::e_divass , details::div_op)
+ case_stmt(details::e_modass , details::mod_op)
#undef case_stmt
default : return error_node();
}
@@ -29212,16 +29764,16 @@
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::assignment_vecvec_op_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
- case_stmt(details::e_addass,details::add_op)
- case_stmt(details::e_subass,details::sub_op)
- case_stmt(details::e_mulass,details::mul_op)
- case_stmt(details::e_divass,details::div_op)
- case_stmt(details::e_modass,details::mod_op)
+ case_stmt(details::e_addass , details::add_op)
+ case_stmt(details::e_subass , details::sub_op)
+ case_stmt(details::e_mulass , details::mul_op)
+ case_stmt(details::e_divass , details::div_op)
+ case_stmt(details::e_modass , details::mod_op)
#undef case_stmt
default : return error_node();
}
@@ -29230,16 +29782,16 @@
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::assignment_vec_op_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
- case_stmt(details::e_addass,details::add_op)
- case_stmt(details::e_subass,details::sub_op)
- case_stmt(details::e_mulass,details::mul_op)
- case_stmt(details::e_divass,details::div_op)
- case_stmt(details::e_modass,details::mod_op)
+ case_stmt(details::e_addass , details::add_op)
+ case_stmt(details::e_subass , details::sub_op)
+ case_stmt(details::e_mulass , details::mul_op)
+ case_stmt(details::e_divass , details::div_op)
+ case_stmt(details::e_modass , details::mod_op)
#undef case_stmt
default : return error_node();
}
@@ -29272,26 +29824,26 @@
const bool is_b0_ivec = details::is_ivector_node(branch[0]);
const bool is_b1_ivec = details::is_ivector_node(branch[1]);
- #define batch_eqineq_logic_case \
- case_stmt(details:: e_lt, details:: lt_op) \
- case_stmt(details:: e_lte, details:: lte_op) \
- case_stmt(details:: e_gt, details:: gt_op) \
- case_stmt(details:: e_gte, details:: gte_op) \
- case_stmt(details:: e_eq, details:: eq_op) \
- case_stmt(details:: e_ne, details:: ne_op) \
- case_stmt(details::e_equal, details::equal_op) \
- case_stmt(details:: e_and, details:: and_op) \
- case_stmt(details:: e_nand, details:: nand_op) \
- case_stmt(details:: e_or, details:: or_op) \
- case_stmt(details:: e_nor, details:: nor_op) \
- case_stmt(details:: e_xor, details:: xor_op) \
- case_stmt(details:: e_xnor, details:: xnor_op) \
+ #define batch_eqineq_logic_case \
+ case_stmt(details::e_lt , details::lt_op ) \
+ case_stmt(details::e_lte , details::lte_op ) \
+ case_stmt(details::e_gt , details::gt_op ) \
+ case_stmt(details::e_gte , details::gte_op ) \
+ case_stmt(details::e_eq , details::eq_op ) \
+ case_stmt(details::e_ne , details::ne_op ) \
+ case_stmt(details::e_equal , details::equal_op) \
+ case_stmt(details::e_and , details::and_op ) \
+ case_stmt(details::e_nand , details::nand_op ) \
+ case_stmt(details::e_or , details::or_op ) \
+ case_stmt(details::e_nor , details::nor_op ) \
+ case_stmt(details::e_xor , details::xor_op ) \
+ case_stmt(details::e_xnor , details::xnor_op ) \
if (is_b0_ivec && is_b1_ivec)
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::vec_binop_vecvec_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
@@ -29305,7 +29857,7 @@
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::vec_binop_vecval_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
@@ -29319,7 +29871,7 @@
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::vec_binop_valvec_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
@@ -29341,18 +29893,18 @@
const bool is_b0_ivec = details::is_ivector_node(branch[0]);
const bool is_b1_ivec = details::is_ivector_node(branch[1]);
- #define vector_ops \
- case_stmt(details::e_add,details::add_op) \
- case_stmt(details::e_sub,details::sub_op) \
- case_stmt(details::e_mul,details::mul_op) \
- case_stmt(details::e_div,details::div_op) \
- case_stmt(details::e_mod,details::mod_op) \
+ #define vector_ops \
+ case_stmt(details::e_add , details::add_op) \
+ case_stmt(details::e_sub , details::sub_op) \
+ case_stmt(details::e_mul , details::mul_op) \
+ case_stmt(details::e_div , details::div_op) \
+ case_stmt(details::e_mod , details::mod_op) \
if (is_b0_ivec && is_b1_ivec)
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::vec_binop_vecvec_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
@@ -29367,7 +29919,7 @@
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::vec_binop_vecval_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
@@ -29382,7 +29934,7 @@
{
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
template allocate_rrr<typename details::vec_binop_valvec_node<Type,op1<Type> > > \
(operation, branch[0], branch[1]); \
@@ -29492,8 +30044,8 @@
if (result)
{
- free_node(*node_allocator_, branch[0]);
- free_node(*node_allocator_, branch[1]);
+ details::free_node(*node_allocator_, branch[0]);
+ details::free_node(*node_allocator_, branch[1]);
return result;
}
@@ -29515,27 +30067,27 @@
}
#endif
- #define basic_opr_switch_statements \
- case_stmt(details::e_add, details::add_op) \
- case_stmt(details::e_sub, details::sub_op) \
- case_stmt(details::e_mul, details::mul_op) \
- case_stmt(details::e_div, details::div_op) \
- case_stmt(details::e_mod, details::mod_op) \
- case_stmt(details::e_pow, details::pow_op) \
+ #define basic_opr_switch_statements \
+ case_stmt(details::e_add , details::add_op) \
+ case_stmt(details::e_sub , details::sub_op) \
+ case_stmt(details::e_mul , details::mul_op) \
+ case_stmt(details::e_div , details::div_op) \
+ case_stmt(details::e_mod , details::mod_op) \
+ case_stmt(details::e_pow , details::pow_op) \
- #define extended_opr_switch_statements \
- case_stmt(details:: e_lt, details:: lt_op) \
- case_stmt(details:: e_lte, details:: lte_op) \
- case_stmt(details:: e_gt, details:: gt_op) \
- case_stmt(details:: e_gte, details:: gte_op) \
- case_stmt(details:: e_eq, details:: eq_op) \
- case_stmt(details:: e_ne, details:: ne_op) \
- case_stmt(details:: e_and, details:: and_op) \
- case_stmt(details::e_nand, details::nand_op) \
- case_stmt(details:: e_or, details:: or_op) \
- case_stmt(details:: e_nor, details:: nor_op) \
- case_stmt(details:: e_xor, details:: xor_op) \
- case_stmt(details::e_xnor, details::xnor_op) \
+ #define extended_opr_switch_statements \
+ case_stmt(details::e_lt , details::lt_op ) \
+ case_stmt(details::e_lte , details::lte_op ) \
+ case_stmt(details::e_gt , details::gt_op ) \
+ case_stmt(details::e_gte , details::gte_op ) \
+ case_stmt(details::e_eq , details::eq_op ) \
+ case_stmt(details::e_ne , details::ne_op ) \
+ case_stmt(details::e_and , details::and_op ) \
+ case_stmt(details::e_nand , details::nand_op) \
+ case_stmt(details::e_or , details::or_op ) \
+ case_stmt(details::e_nor , details::nor_op ) \
+ case_stmt(details::e_xor , details::xor_op ) \
+ case_stmt(details::e_xnor , details::xnor_op) \
#ifndef exprtk_disable_cardinal_pow_optimisation
template <typename TType, template <typename, typename> class IPowNode>
@@ -29766,7 +30318,7 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return expr_gen.node_allocator_-> \
template allocate<typename details::binary_ext_node<Type,op1<Type> > > \
(branch[0], branch[1]); \
@@ -29798,7 +30350,7 @@
if (synthesis_result)
{
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
return result;
}
}
@@ -29819,7 +30371,7 @@
{
const Type& v1 = static_cast<uvbn_ptr_t>(branch[1])->v();
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
switch (operation)
{
@@ -29841,7 +30393,7 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return expr_gen.node_allocator_-> \
template allocate_rc<typename details::vob_node<Type,op1<Type> > > \
(v, branch[1]); \
@@ -29873,7 +30425,7 @@
if (synthesis_result)
{
- free_node(*expr_gen.node_allocator_, branch[0]);
+ details::free_node(*expr_gen.node_allocator_, branch[0]);
return result;
}
@@ -29897,7 +30449,7 @@
{
const Type& v0 = static_cast<uvbn_ptr_t>(branch[0])->v();
- free_node(*expr_gen.node_allocator_,branch[0]);
+ details::free_node(*expr_gen.node_allocator_,branch[0]);
switch (operation)
{
@@ -29927,7 +30479,7 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return expr_gen.node_allocator_-> \
template allocate_cr<typename details::bov_node<Type,op1<Type> > > \
(branch[0], v); \
@@ -29948,17 +30500,17 @@
{
const Type c = static_cast<details::literal_node<Type>*>(branch[0])->value();
- free_node(*expr_gen.node_allocator_,branch[0]);
+ details::free_node(*expr_gen.node_allocator_,branch[0]);
if (std::equal_to<T>()(T(0),c) && (details::e_mul == operation))
{
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
return expr_gen(T(0));
}
else if (std::equal_to<T>()(T(0),c) && (details::e_div == operation))
{
- free_node(*expr_gen.node_allocator_, branch[1]);
+ details::free_node(*expr_gen.node_allocator_, branch[1]);
return expr_gen(T(0));
}
@@ -29973,8 +30525,8 @@
// 1. (1 * (2 * (3 * (4 * (5 * (6 * (7 * (8 * (9 + x))))))))) --> 40320 * (9 + x)
// 2. (1 + (2 + (3 + (4 + (5 + (6 + (7 + (8 + (9 + x))))))))) --> 45 + x
if (
- (operation == details::e_mul) ||
- (operation == details::e_add)
+ (details::e_mul == operation) ||
+ (details::e_add == operation)
)
{
details::cob_base_node<Type>* cobnode = static_cast<details::cob_base_node<Type>*>(branch[1]);
@@ -30039,7 +30591,7 @@
default : return error_node();
}
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
return new_cobnode;
}
@@ -30056,7 +30608,7 @@
if (synthesis_result)
{
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
return result;
}
@@ -30065,7 +30617,7 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return expr_gen.node_allocator_-> \
template allocate_tt<typename details::cob_node<Type,op1<Type> > > \
(c, branch[1]); \
@@ -30090,13 +30642,13 @@
if (std::equal_to<T>()(T(0),c) && (details::e_mul == operation))
{
- free_node(*expr_gen.node_allocator_, branch[0]);
+ details::free_node(*expr_gen.node_allocator_, branch[0]);
return expr_gen(T(0));
}
else if (std::equal_to<T>()(T(0),c) && (details::e_div == operation))
{
- free_node(*expr_gen.node_allocator_, branch[0]);
+ details::free_node(*expr_gen.node_allocator_, branch[0]);
return expr_gen(std::numeric_limits<T>::quiet_NaN());
}
@@ -30111,8 +30663,8 @@
// 1. (((((((((x + 9) * 8) * 7) * 6) * 5) * 4) * 3) * 2) * 1) --> (x + 9) * 40320
// 2. (((((((((x + 9) + 8) + 7) + 6) + 5) + 4) + 3) + 2) + 1) --> x + 45
if (
- (operation == details::e_mul) ||
- (operation == details::e_add)
+ (details::e_mul == operation) ||
+ (details::e_add == operation)
)
{
details::boc_base_node<Type>* bocnode = static_cast<details::boc_base_node<Type>*>(branch[0]);
@@ -30184,7 +30736,7 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return expr_gen.node_allocator_-> \
template allocate_cr<typename details::boc_node<Type,op1<Type> > > \
(branch[0], c); \
@@ -30214,33 +30766,33 @@
if (std::equal_to<T>()(T(0),c) && (details::e_mul == operation))
{
- free_node(*expr_gen.node_allocator_, branch[0]);
- free_node(*expr_gen.node_allocator_, branch[1]);
+ details::free_node(*expr_gen.node_allocator_, branch[0]);
+ details::free_node(*expr_gen.node_allocator_, branch[1]);
return expr_gen(T(0));
}
else if (std::equal_to<T>()(T(0),c) && (details::e_div == operation))
{
- free_node(*expr_gen.node_allocator_, branch[0]);
- free_node(*expr_gen.node_allocator_, branch[1]);
+ details::free_node(*expr_gen.node_allocator_, branch[0]);
+ details::free_node(*expr_gen.node_allocator_, branch[1]);
return expr_gen(T(std::numeric_limits<T>::quiet_NaN()));
}
else if (std::equal_to<T>()(T(0),c) && (details::e_add == operation))
{
- free_node(*expr_gen.node_allocator_, branch[1]);
+ details::free_node(*expr_gen.node_allocator_, branch[1]);
return branch[0];
}
else if (std::equal_to<T>()(T(1),c) && (details::e_mul == operation))
{
- free_node(*expr_gen.node_allocator_, branch[1]);
+ details::free_node(*expr_gen.node_allocator_, branch[1]);
return branch[0];
}
else if (std::equal_to<T>()(T(1),c) && (details::e_div == operation))
{
- free_node(*expr_gen.node_allocator_, branch[1]);
+ details::free_node(*expr_gen.node_allocator_, branch[1]);
return branch[0];
}
@@ -30283,13 +30835,13 @@
template allocate_tt<typename details::cob_node<Type,details::div_op<Type> > >
(cobnode->c() / c, cobnode->move_branch(0));
- free_node(*expr_gen.node_allocator_, branch[0]);
+ details::free_node(*expr_gen.node_allocator_, branch[0]);
}
}
if (result)
{
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
}
}
@@ -30302,27 +30854,27 @@
if (std::equal_to<T>()(T(0),c) && (details::e_mul == operation))
{
- free_node(*expr_gen.node_allocator_, branch[0]);
- free_node(*expr_gen.node_allocator_, branch[1]);
+ details::free_node(*expr_gen.node_allocator_, branch[0]);
+ details::free_node(*expr_gen.node_allocator_, branch[1]);
return expr_gen(T(0));
}
else if (std::equal_to<T>()(T(0),c) && (details::e_div == operation))
{
- free_node(*expr_gen.node_allocator_, branch[0]);
- free_node(*expr_gen.node_allocator_, branch[1]);
+ details::free_node(*expr_gen.node_allocator_, branch[0]);
+ details::free_node(*expr_gen.node_allocator_, branch[1]);
return expr_gen(T(0));
}
else if (std::equal_to<T>()(T(0),c) && (details::e_add == operation))
{
- free_node(*expr_gen.node_allocator_, branch[0]);
+ details::free_node(*expr_gen.node_allocator_, branch[0]);
return branch[1];
}
else if (std::equal_to<T>()(T(1),c) && (details::e_mul == operation))
{
- free_node(*expr_gen.node_allocator_, branch[0]);
+ details::free_node(*expr_gen.node_allocator_, branch[0]);
return branch[1];
}
@@ -30340,7 +30892,7 @@
template allocate_tt<typename details::cob_node<Type,details::sub_op<Type> > >
(c - cobnode->c(), cobnode->move_branch(0));
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
}
}
else if (details::e_sub == cobnode->operation())
@@ -30356,7 +30908,7 @@
template allocate_tt<typename details::cob_node<Type,details::add_op<Type> > >
(c - cobnode->c(), cobnode->move_branch(0));
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
}
}
else if (details::e_mul == cobnode->operation())
@@ -30372,7 +30924,7 @@
template allocate_tt<typename details::cob_node<Type,details::div_op<Type> > >
(c / cobnode->c(), cobnode->move_branch(0));
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
}
}
else if (details::e_div == cobnode->operation())
@@ -30388,13 +30940,13 @@
template allocate_tt<typename details::cob_node<Type,details::mul_op<Type> > >
(c / cobnode->c(), cobnode->move_branch(0));
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
}
}
if (result)
{
- free_node(*expr_gen.node_allocator_,branch[0]);
+ details::free_node(*expr_gen.node_allocator_,branch[0]);
}
}
@@ -30447,7 +30999,7 @@
template allocate_tt<typename details::boc_node<Type,details::add_op<Type> > >
(bocnode->move_branch(0), c - bocnode->c());
- free_node(*expr_gen.node_allocator_,branch[0]);
+ details::free_node(*expr_gen.node_allocator_,branch[0]);
}
else if (details::e_sub == operation)
{
@@ -30469,7 +31021,7 @@
if (result)
{
- free_node(*expr_gen.node_allocator_, branch[1]);
+ details::free_node(*expr_gen.node_allocator_, branch[1]);
}
}
@@ -30493,7 +31045,7 @@
template allocate_tt<typename details::cob_node<Type,details::sub_op<Type> > >
(c - bocnode->c(), bocnode->move_branch(0));
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
}
}
else if (details::e_sub == bocnode->operation())
@@ -30504,7 +31056,7 @@
template allocate_tt<typename details::boc_node<Type,details::add_op<Type> > >
(bocnode->move_branch(0), c - bocnode->c());
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
}
else if (details::e_sub == operation)
{
@@ -30512,7 +31064,7 @@
template allocate_tt<typename details::cob_node<Type,details::sub_op<Type> > >
(c + bocnode->c(), bocnode->move_branch(0));
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
}
}
else if (details::e_mul == bocnode->operation())
@@ -30528,7 +31080,7 @@
template allocate_tt<typename details::cob_node<Type,details::div_op<Type> > >
(c / bocnode->c(), bocnode->move_branch(0));
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
}
}
else if (details::e_div == bocnode->operation())
@@ -30544,13 +31096,13 @@
template allocate_tt<typename details::cob_node<Type,details::div_op<Type> > >
(c * bocnode->c(), bocnode->move_branch(0));
- free_node(*expr_gen.node_allocator_,branch[1]);
+ details::free_node(*expr_gen.node_allocator_,branch[1]);
}
}
if (result)
{
- free_node(*expr_gen.node_allocator_,branch[0]);
+ details::free_node(*expr_gen.node_allocator_,branch[0]);
}
}
@@ -30593,7 +31145,7 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return expr_gen.node_allocator_-> \
template allocate_rr<typename details::vov_node<Type,op1<Type> > > \
(v1, v2); \
@@ -30628,7 +31180,7 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return expr_gen.node_allocator_-> \
template allocate_cr<typename details::cov_node<Type,op1<Type> > > \
(c, v); \
@@ -30672,7 +31224,7 @@
switch (operation)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return expr_gen.node_allocator_-> \
template allocate_rc<typename details::voc_node<Type,op1<Type> > > \
(v, c); \
@@ -30741,7 +31293,6 @@
case details::e_sf##op : return details::T0oT1oT2oT3_sf4ext<Type,T0,T1,T2,T3,details::sf##op##_op<Type> >:: \
allocate(*(expr_gen.node_allocator_), t0, t1, t2, t3); \
-
#define case_stmt1(op) \
case details::e_sf4ext##op : return details::T0oT1oT2oT3_sf4ext<Type,T0,T1,T2,T3,details::sfext##op##_op<Type> >:: \
allocate(*(expr_gen.node_allocator_), t0, t1, t2, t3); \
@@ -30942,9 +31493,6 @@
const details::operator_type o0 = vov->operation();
const details::operator_type o1 = operation;
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
expression_node_ptr result = error_node();
@@ -30956,7 +31504,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<vtype,vtype,vtype>(expr_gen, "t/(t*t)", v0, v1, v2, result);
+ template compile<vtype, vtype, vtype>(expr_gen, "t/(t*t)", v0, v1, v2, result);
exprtk_debug(("(v0 / v1) / v2 --> (vovov) v0 / (v1 * v2)\n"));
@@ -30970,7 +31518,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -30979,7 +31531,8 @@
}
static inline std::string id(expression_generator<Type>& expr_gen,
- const details::operator_type o0, const details::operator_type o1)
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "(t" << expr_gen.to_str(o0)
@@ -31005,9 +31558,6 @@
const details::operator_type o0 = operation;
const details::operator_type o1 = vov->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[1]);
expression_node_ptr result = error_node();
@@ -31019,7 +31569,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<vtype,vtype,vtype>(expr_gen, "(t*t)/t", v0, v2, v1, result);
+ template compile<vtype, vtype, vtype>(expr_gen, "(t*t)/t", v0, v2, v1, result);
exprtk_debug(("v0 / (v1 / v2) --> (vovov) (v0 * v2) / v1\n"));
@@ -31033,7 +31583,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -31042,7 +31596,8 @@
}
static inline std::string id(expression_generator<Type>& expr_gen,
- const details::operator_type o0, const details::operator_type o1)
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "t" << expr_gen.to_str(o0)
@@ -31068,9 +31623,6 @@
const details::operator_type o0 = vov->operation();
const details::operator_type o1 = operation;
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -31083,7 +31635,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<vtype,vtype,ctype>(expr_gen, "t/(t*t)", v0, v1, c, result);
+ template compile<vtype, vtype, ctype>(expr_gen, "t/(t*t)", v0, v1, c, result);
exprtk_debug(("(v0 / v1) / c --> (vovoc) v0 / (v1 * c)\n"));
@@ -31097,7 +31649,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -31106,7 +31662,8 @@
}
static inline std::string id(expression_generator<Type>& expr_gen,
- const details::operator_type o0, const details::operator_type o1)
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "(t" << expr_gen.to_str(o0)
@@ -31132,9 +31689,6 @@
const details::operator_type o0 = operation;
const details::operator_type o1 = voc->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[1]);
expression_node_ptr result = error_node();
@@ -31146,7 +31700,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<vtype,ctype,vtype>(expr_gen, "(t*t)/t", v0, c, v1, result);
+ template compile<vtype, ctype, vtype>(expr_gen, "(t*t)/t", v0, c, v1, result);
exprtk_debug(("v0 / (v1 / c) --> (vocov) (v0 * c) / v1\n"));
@@ -31160,7 +31714,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -31169,7 +31727,8 @@
}
static inline std::string id(expression_generator<Type>& expr_gen,
- const details::operator_type o0, const details::operator_type o1)
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "t" << expr_gen.to_str(o0)
@@ -31195,9 +31754,6 @@
const details::operator_type o0 = voc->operation();
const details::operator_type o1 = operation;
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
expression_node_ptr result = error_node();
@@ -31209,7 +31765,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<vtype,vtype,ctype>(expr_gen, "t/(t*t)", v0, v1, c, result);
+ template compile<vtype, vtype, ctype>(expr_gen, "t/(t*t)", v0, v1, c, result);
exprtk_debug(("(v0 / c) / v1 --> (vovoc) v0 / (v1 * c)\n"));
@@ -31223,7 +31779,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -31232,7 +31792,8 @@
}
static inline std::string id(expression_generator<Type>& expr_gen,
- const details::operator_type o0, const details::operator_type o1)
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "(t" << expr_gen.to_str(o0)
@@ -31258,9 +31819,6 @@
const details::operator_type o0 = operation;
const details::operator_type o1 = cov->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[1]);
expression_node_ptr result = error_node();
@@ -31286,7 +31844,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -31295,7 +31857,8 @@
}
static inline std::string id(expression_generator<Type>& expr_gen,
- const details::operator_type o0, const details::operator_type o1)
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "t" << expr_gen.to_str(o0)
@@ -31321,9 +31884,6 @@
const details::operator_type o0 = cov->operation();
const details::operator_type o1 = operation;
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
expression_node_ptr result = error_node();
@@ -31349,7 +31909,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -31358,7 +31922,8 @@
}
static inline std::string id(expression_generator<Type>& expr_gen,
- const details::operator_type o0, const details::operator_type o1)
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "(t" << expr_gen.to_str(o0)
@@ -31384,9 +31949,6 @@
const details::operator_type o0 = operation;
const details::operator_type o1 = vov->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -31413,7 +31975,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -31421,7 +31987,9 @@
return node_type::allocate(*(expr_gen.node_allocator_), c, v0, v1, f0, f1);
}
- static inline std::string id(expression_generator<Type>& expr_gen, const details::operator_type o0, const details::operator_type o1)
+ static inline std::string id(expression_generator<Type>& expr_gen,
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "t" << expr_gen.to_str(o0)
@@ -31447,9 +32015,6 @@
const details::operator_type o0 = cov->operation();
const details::operator_type o1 = operation;
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -31529,7 +32094,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -31538,7 +32107,8 @@
}
static inline std::string id(expression_generator<Type>& expr_gen,
- const details::operator_type o0, const details::operator_type o1)
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "(t" << expr_gen.to_str(o0)
@@ -31564,9 +32134,6 @@
const details::operator_type o0 = operation;
const details::operator_type o1 = voc->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -31646,7 +32213,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -31655,7 +32226,8 @@
}
static inline std::string id(expression_generator<Type>& expr_gen,
- const details::operator_type o0, const details::operator_type o1)
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "t" << expr_gen.to_str(o0)
@@ -31667,7 +32239,9 @@
struct synthesize_cocov_expression0
{
typedef typename cocov_t::type0 node_type;
- static inline expression_node_ptr process(expression_generator<Type>&, const details::operator_type&, expression_node_ptr (&)[2])
+ static inline expression_node_ptr process(expression_generator<Type>&,
+ const details::operator_type&,
+ expression_node_ptr (&)[2])
{
// (c0 o0 c1) o1 (v) - Not possible.
return error_node();
@@ -31691,9 +32265,6 @@
const details::operator_type o0 = operation;
const details::operator_type o1 = cov->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -31773,7 +32344,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -31781,7 +32356,9 @@
return node_type::allocate(*(expr_gen.node_allocator_), c0, c1, v, f0, f1);
}
- static inline std::string id(expression_generator<Type>& expr_gen, const details::operator_type o0, const details::operator_type o1)
+ static inline std::string id(expression_generator<Type>& expr_gen,
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "t" << expr_gen.to_str(o0)
@@ -31807,9 +32384,6 @@
const details::operator_type o0 = voc->operation();
const details::operator_type o1 = operation;
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -31897,7 +32471,11 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -31906,7 +32484,8 @@
}
static inline std::string id(expression_generator<Type>& expr_gen,
- const details::operator_type o0, const details::operator_type o1)
+ const details::operator_type o0,
+ const details::operator_type o1)
{
return details::build_string()
<< "(t" << expr_gen.to_str(o0)
@@ -31919,7 +32498,9 @@
{
typedef typename vococ_t::type0 node_type;
- static inline expression_node_ptr process(expression_generator<Type>&, const details::operator_type&, expression_node_ptr (&)[2])
+ static inline expression_node_ptr process(expression_generator<Type>&,
+ const details::operator_type&,
+ expression_node_ptr (&)[2])
{
// (v) o0 (c0 o1 c1) - Not possible.
exprtk_debug(("(v) o0 (c0 o1 c1) - Not possible.\n"));
@@ -31951,10 +32532,6 @@
const details::operator_type o1 = operation;
const details::operator_type o2 = vov1->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -31967,7 +32544,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,vtype,vtype,vtype>(expr_gen, "(t*t)/(t*t)", v0, v2, v1, v3, result);
+ template compile<vtype, vtype, vtype, vtype>(expr_gen, "(t*t)/(t*t)", v0, v2, v1, v3, result);
exprtk_debug(("(v0 / v1) * (v2 / v3) --> (vovovov) (v0 * v2) / (v1 * v3)\n"));
@@ -31978,7 +32555,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,vtype,vtype,vtype>(expr_gen, "(t*t)/(t*t)", v0, v3, v1, v2, result);
+ template compile<vtype, vtype, vtype, vtype>(expr_gen, "(t*t)/(t*t)", v0, v3, v1, v2, result);
exprtk_debug(("(v0 / v1) / (v2 / v3) --> (vovovov) (v0 * v3) / (v1 * v2)\n"));
@@ -31989,7 +32566,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,vtype,vtype,vtype>(expr_gen, "(t+t)*(t/t)", v0, v1, v3, v2, result);
+ template compile<vtype, vtype, vtype, vtype>(expr_gen, "(t+t)*(t/t)", v0, v1, v3, v2, result);
exprtk_debug(("(v0 + v1) / (v2 / v3) --> (vovovov) (v0 + v1) * (v3 / v2)\n"));
@@ -32000,7 +32577,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,vtype,vtype,vtype>(expr_gen, "(t-t)*(t/t)", v0, v1, v3, v2, result);
+ template compile<vtype, vtype, vtype, vtype>(expr_gen, "(t-t)*(t/t)", v0, v1, v3, v2, result);
exprtk_debug(("(v0 - v1) / (v2 / v3) --> (vovovov) (v0 - v1) * (v3 / v2)\n"));
@@ -32011,7 +32588,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,vtype,vtype,vtype>(expr_gen, "((t*t)*t)/t", v0, v1, v3, v2, result);
+ template compile<vtype, vtype, vtype, vtype>(expr_gen, "((t*t)*t)/t", v0, v1, v3, v2, result);
exprtk_debug(("(v0 * v1) / (v2 / v3) --> (vovovov) ((v0 * v1) * v3) / v2\n"));
@@ -32025,7 +32602,12 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -32072,10 +32654,6 @@
const details::operator_type o1 = operation;
const details::operator_type o2 = voc->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -32088,7 +32666,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,vtype,vtype,ctype>(expr_gen, "(t*t)/(t*t)", v0, v2, v1, c, result);
+ template compile<vtype, vtype, vtype, ctype>(expr_gen, "(t*t)/(t*t)", v0, v2, v1, c, result);
exprtk_debug(("(v0 / v1) * (v2 / c) --> (vovovoc) (v0 * v2) / (v1 * c)\n"));
@@ -32099,7 +32677,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,ctype,vtype,vtype>(expr_gen, "(t*t)/(t*t)", v0, c, v1, v2, result);
+ template compile<vtype, ctype, vtype, vtype>(expr_gen, "(t*t)/(t*t)", v0, c, v1, v2, result);
exprtk_debug(("(v0 / v1) / (v2 / c) --> (vocovov) (v0 * c) / (v1 * v2)\n"));
@@ -32113,7 +32691,12 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -32160,10 +32743,6 @@
const details::operator_type o1 = operation;
const details::operator_type o2 = cov->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -32176,7 +32755,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,ctype,vtype,vtype>(expr_gen, "(t*t)/(t*t)", v0, c, v1, v2, result);
+ template compile<vtype, ctype, vtype, vtype>(expr_gen, "(t*t)/(t*t)", v0, c, v1, v2, result);
exprtk_debug(("(v0 / v1) * (c / v2) --> (vocovov) (v0 * c) / (v1 * v2)\n"));
@@ -32187,7 +32766,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,vtype,vtype,ctype>(expr_gen, "(t*t)/(t*t)", v0, v2, v1, c, result);
+ template compile<vtype, vtype, vtype, ctype>(expr_gen, "(t*t)/(t*t)", v0, v2, v1, c, result);
exprtk_debug(("(v0 / v1) / (c / v2) --> (vovovoc) (v0 * v2) / (v1 * c)\n"));
@@ -32201,7 +32780,12 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -32248,10 +32832,6 @@
const details::operator_type o1 = operation;
const details::operator_type o2 = vov->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -32264,7 +32844,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,vtype,ctype,vtype>(expr_gen, "(t*t)/(t*t)", v0, v1, c, v2, result);
+ template compile<vtype, vtype, ctype, vtype>(expr_gen, "(t*t)/(t*t)", v0, v1, c, v2, result);
exprtk_debug(("(v0 / c) * (v1 / v2) --> (vovocov) (v0 * v1) / (c * v2)\n"));
@@ -32275,7 +32855,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,vtype,ctype,vtype>(expr_gen, "(t*t)/(t*t)", v0, v2, c, v1, result);
+ template compile<vtype, vtype, ctype, vtype>(expr_gen, "(t*t)/(t*t)", v0, v2, c, v1, result);
exprtk_debug(("(v0 / c) / (v1 / v2) --> (vovocov) (v0 * v2) / (c * v1)\n"));
@@ -32289,7 +32869,12 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -32336,10 +32921,6 @@
const details::operator_type o1 = operation;
const details::operator_type o2 = vov->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -32352,7 +32933,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<ctype,vtype,vtype,vtype>(expr_gen, "(t*t)/(t*t)", c, v1, v0, v2, result);
+ template compile<ctype, vtype, vtype, vtype>(expr_gen, "(t*t)/(t*t)", c, v1, v0, v2, result);
exprtk_debug(("(c / v0) * (v1 / v2) --> (covovov) (c * v1) / (v0 * v2)\n"));
@@ -32363,7 +32944,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<ctype,vtype,vtype,vtype>(expr_gen, "(t*t)/(t*t)", c, v2, v0, v1, result);
+ template compile<ctype, vtype, vtype, vtype>(expr_gen, "(t*t)/(t*t)", c, v2, v0, v1, result);
exprtk_debug(("(c / v0) / (v1 / v2) --> (covovov) (c * v2) / (v0 * v1)\n"));
@@ -32377,7 +32958,12 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -32424,10 +33010,6 @@
const details::operator_type o1 = operation;
const details::operator_type o2 = cov1->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -32440,7 +33022,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t+t)+t", (c0 + c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t+t)+t", (c0 + c1), v0, v1, result);
exprtk_debug(("(c0 + v0) + (c1 + v1) --> (covov) (c0 + c1) + v0 + v1\n"));
@@ -32451,7 +33033,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t+t)-t", (c0 - c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t+t)-t", (c0 - c1), v0, v1, result);
exprtk_debug(("(c0 + v0) - (c1 + v1) --> (covov) (c0 - c1) + v0 - v1\n"));
@@ -32462,7 +33044,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t-t)+t", (c0 - c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t-t)+t", (c0 - c1), v0, v1, result);
exprtk_debug(("(c0 - v0) - (c1 - v1) --> (covov) (c0 - c1) - v0 + v1\n"));
@@ -32473,7 +33055,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)*t", (c0 * c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)*t", (c0 * c1), v0, v1, result);
exprtk_debug(("(c0 * v0) * (c1 * v1) --> (covov) (c0 * c1) * v0 * v1\n"));
@@ -32484,7 +33066,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)/t", (c0 / c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)/t", (c0 / c1), v0, v1, result);
exprtk_debug(("(c0 * v0) / (c1 * v1) --> (covov) (c0 / c1) * (v0 / v1)\n"));
@@ -32495,7 +33077,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "t/(t*t)", (c0 * c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "t/(t*t)", (c0 * c1), v0, v1, result);
exprtk_debug(("(c0 / v0) * (c1 / v1) --> (covov) (c0 * c1) / (v0 * v1)\n"));
@@ -32506,7 +33088,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)/t", (c0 / c1), v1, v0, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)/t", (c0 / c1), v1, v0, result);
exprtk_debug(("(c0 / v0) / (c1 / v1) --> (covov) ((c0 / c1) * v1) / v0\n"));
@@ -32517,7 +33099,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "t*(t*t)", (c0 / c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "t*(t*t)", (c0 / c1), v0, v1, result);
exprtk_debug(("(c0 * v0) / (c1 / v1) --> (covov) (c0 / c1) * (v0 * v1)\n"));
@@ -32528,7 +33110,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "t/(t*t)", (c0 / c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "t/(t*t)", (c0 / c1), v0, v1, result);
exprtk_debug(("(c0 / v0) / (c1 * v1) --> (covov) (c0 / c1) / (v0 * v1)\n"));
@@ -32570,7 +33152,12 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -32617,10 +33204,6 @@
const details::operator_type o1 = operation;
const details::operator_type o2 = voc1->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -32633,7 +33216,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t+t)+t", (c0 + c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t+t)+t", (c0 + c1), v0, v1, result);
exprtk_debug(("(v0 + c0) + (v1 + c1) --> (covov) (c0 + c1) + v0 + v1\n"));
@@ -32644,7 +33227,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t+t)-t", (c0 - c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t+t)-t", (c0 - c1), v0, v1, result);
exprtk_debug(("(v0 + c0) - (v1 + c1) --> (covov) (c0 - c1) + v0 - v1\n"));
@@ -32655,7 +33238,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t+t)-t", (c1 - c0), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t+t)-t", (c1 - c0), v0, v1, result);
exprtk_debug(("(v0 - c0) - (v1 - c1) --> (covov) (c1 - c0) + v0 - v1\n"));
@@ -32666,7 +33249,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)*t", (c0 * c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)*t", (c0 * c1), v0, v1, result);
exprtk_debug(("(v0 * c0) * (v1 * c1) --> (covov) (c0 * c1) * v0 * v1\n"));
@@ -32677,7 +33260,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)/t", (c0 / c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)/t", (c0 / c1), v0, v1, result);
exprtk_debug(("(v0 * c0) / (v1 * c1) --> (covov) (c0 / c1) * (v0 / v1)\n"));
@@ -32688,7 +33271,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)*t", Type(1) / (c0 * c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)*t", Type(1) / (c0 * c1), v0, v1, result);
exprtk_debug(("(v0 / c0) * (v1 / c1) --> (covov) (1 / (c0 * c1)) * v0 * v1\n"));
@@ -32699,7 +33282,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)/t", (c1 / c0), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)/t", (c1 / c0), v0, v1, result);
exprtk_debug(("(v0 / c0) / (v1 / c1) --> (covov) ((c1 / c0) * v0) / v1\n"));
@@ -32710,7 +33293,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "t*(t/t)", (c0 * c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "t*(t/t)", (c0 * c1), v0, v1, result);
exprtk_debug(("(v0 * c0) / (v1 / c1) --> (covov) (c0 * c1) * (v0 / v1)\n"));
@@ -32721,7 +33304,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "t*(t/t)", Type(1) / (c0 * c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "t*(t/t)", Type(1) / (c0 * c1), v0, v1, result);
exprtk_debug(("(v0 / c0) / (v1 * c1) --> (covov) (1 / (c0 * c1)) * v0 / v1\n"));
@@ -32732,7 +33315,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,ctype,vtype,ctype>(expr_gen, "(t*t)*(t+t)", v0, T(1) / c0, v1, c1, result);
+ template compile<vtype, ctype, vtype, ctype>(expr_gen, "(t*t)*(t+t)", v0, T(1) / c0, v1, c1, result);
exprtk_debug(("(v0 / c0) * (v1 + c1) --> (vocovoc) (v0 * (1 / c0)) * (v1 + c1)\n"));
@@ -32743,7 +33326,7 @@
{
const bool synthesis_result =
synthesize_sf4ext_expression::
- template compile<vtype,ctype,vtype,ctype>(expr_gen, "(t*t)*(t-t)", v0, T(1) / c0, v1, c1, result);
+ template compile<vtype, ctype, vtype, ctype>(expr_gen, "(t*t)*(t-t)", v0, T(1) / c0, v1, c1, result);
exprtk_debug(("(v0 / c0) * (v1 - c1) --> (vocovoc) (v0 * (1 / c0)) * (v1 - c1)\n"));
@@ -32771,7 +33354,7 @@
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, specfunc, c0, v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, specfunc, c0, v0, v1, result);
exprtk_debug(("(v0 * c) +/- (v1 * c) --> (covov) c * (v0 +/- v1)\n"));
@@ -32799,7 +33382,7 @@
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<vtype,vtype,ctype>(expr_gen, specfunc, v0, v1, c0, result);
+ template compile<vtype, vtype, ctype>(expr_gen, specfunc, v0, v1, c0, result);
exprtk_debug(("(v0 / c) +/- (v1 / c) --> (vovoc) (v0 +/- v1) / c\n"));
@@ -32813,7 +33396,12 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -32860,10 +33448,6 @@
const details::operator_type o1 = operation;
const details::operator_type o2 = voc->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -32876,7 +33460,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t+t)+t", (c0 + c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t+t)+t", (c0 + c1), v0, v1, result);
exprtk_debug(("(c0 + v0) + (v1 + c1) --> (covov) (c0 + c1) + v0 + v1\n"));
@@ -32887,7 +33471,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t+t)-t", (c0 - c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t+t)-t", (c0 - c1), v0, v1, result);
exprtk_debug(("(c0 + v0) - (v1 + c1) --> (covov) (c0 - c1) + v0 - v1\n"));
@@ -32898,7 +33482,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "t-(t+t)", (c0 + c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "t-(t+t)", (c0 + c1), v0, v1, result);
exprtk_debug(("(c0 - v0) - (v1 - c1) --> (covov) (c0 + c1) - v0 - v1\n"));
@@ -32909,7 +33493,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)*t", (c0 * c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)*t", (c0 * c1), v0, v1, result);
exprtk_debug(("(c0 * v0) * (v1 * c1) --> (covov) (c0 * c1) * v0 * v1\n"));
@@ -32920,7 +33504,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)/t", (c0 / c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)/t", (c0 / c1), v0, v1, result);
exprtk_debug(("(c0 * v0) / (v1 * c1) --> (covov) (c0 / c1) * (v0 / v1)\n"));
@@ -32931,7 +33515,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "t*(t/t)", (c0 / c1), v1, v0, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "t*(t/t)", (c0 / c1), v1, v0, result);
exprtk_debug(("(c0 / v0) * (v1 / c1) --> (covov) (c0 / c1) * (v1 / v0)\n"));
@@ -32942,7 +33526,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "t/(t*t)", (c0 * c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "t/(t*t)", (c0 * c1), v0, v1, result);
exprtk_debug(("(c0 / v0) / (v1 / c1) --> (covov) (c0 * c1) / (v0 * v1)\n"));
@@ -32953,7 +33537,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)/t", (c0 * c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)/t", (c0 * c1), v0, v1, result);
exprtk_debug(("(c0 * v0) / (v1 / c1) --> (covov) (c0 * c1) * (v0 / v1)\n"));
@@ -32964,7 +33548,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "t/(t*t)", (c0 / c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "t/(t*t)", (c0 / c1), v0, v1, result);
exprtk_debug(("(c0 / v0) / (v1 * c1) --> (covov) (c0 / c1) / (v0 * v1)\n"));
@@ -32992,7 +33576,7 @@
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen,specfunc, c0, v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, specfunc, c0, v0, v1, result);
exprtk_debug(("(c * v0) +/- (v1 * c) --> (covov) c * (v0 +/- v1)\n"));
@@ -33006,7 +33590,12 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -33053,10 +33642,6 @@
const details::operator_type o1 = operation;
const details::operator_type o2 = cov->operation();
- binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
- binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
-
details::free_node(*(expr_gen.node_allocator_),branch[0]);
details::free_node(*(expr_gen.node_allocator_),branch[1]);
@@ -33069,7 +33654,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t+t)+t", (c0 + c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t+t)+t", (c0 + c1), v0, v1, result);
exprtk_debug(("(v0 + c0) + (c1 + v1) --> (covov) (c0 + c1) + v0 + v1\n"));
@@ -33080,7 +33665,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t+t)-t", (c0 - c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t+t)-t", (c0 - c1), v0, v1, result);
exprtk_debug(("(v0 + c0) - (c1 + v1) --> (covov) (c0 - c1) + v0 - v1\n"));
@@ -33091,7 +33676,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<vtype,vtype,ctype>(expr_gen, "(t+t)-t", v0, v1, (c1 + c0), result);
+ template compile<vtype, vtype, ctype>(expr_gen, "(t+t)-t", v0, v1, (c1 + c0), result);
exprtk_debug(("(v0 - c0) - (c1 - v1) --> (vovoc) v0 + v1 - (c1 + c0)\n"));
@@ -33102,7 +33687,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)*t", (c0 * c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)*t", (c0 * c1), v0, v1, result);
exprtk_debug(("(v0 * c0) * (c1 * v1) --> (covov) (c0 * c1) * v0 * v1\n"));
@@ -33113,7 +33698,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)/t", (c0 / c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)/t", (c0 / c1), v0, v1, result);
exprtk_debug(("(v0 * c0) / (c1 * v1) --> (covov) (c0 / c1) * (v0 * v1)\n"));
@@ -33124,7 +33709,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)/t", (c1 / c0), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)/t", (c1 / c0), v0, v1, result);
exprtk_debug(("(v0 / c0) * (c1 / v1) --> (covov) (c1 / c0) * (v0 / v1)\n"));
@@ -33135,7 +33720,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)*t", (c0 / c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)*t", (c0 / c1), v0, v1, result);
exprtk_debug(("(v0 * c0) / (c1 / v1) --> (covov) (c0 / c1) * (v0 * v1)\n"));
@@ -33146,7 +33731,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, "(t*t)/t", Type(1) / (c0 * c1), v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, "(t*t)/t", Type(1) / (c0 * c1), v0, v1, result);
exprtk_debug(("(v0 / c0) / (c1 * v1) --> (covov) (1 / (c0 * c1)) * (v0 / v1)\n"));
@@ -33157,7 +33742,7 @@
{
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<vtype,vtype,ctype>(expr_gen, "(t*t)*t", v0, v1, Type(1) / (c0 * c1), result);
+ template compile<vtype, vtype, ctype>(expr_gen, "(t*t)*t", v0, v1, Type(1) / (c0 * c1), result);
exprtk_debug(("(v0 / c0) / (c1 / v1) --> (vovoc) (v0 * v1) * (1 / (c0 * c1))\n"));
@@ -33184,7 +33769,7 @@
const bool synthesis_result =
synthesize_sf3ext_expression::
- template compile<ctype,vtype,vtype>(expr_gen, specfunc, c0, v0, v1, result);
+ template compile<ctype, vtype, vtype>(expr_gen, specfunc, c0, v0, v1, result);
exprtk_debug(("(v0 * c) +/- (c * v1) --> (covov) c * (v0 +/- v1)\n"));
@@ -33198,7 +33783,12 @@
if (synthesis_result)
return result;
- else if (!expr_gen.valid_operator(o0,f0))
+
+ binary_functor_t f0 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f1 = reinterpret_cast<binary_functor_t>(0);
+ binary_functor_t f2 = reinterpret_cast<binary_functor_t>(0);
+
+ if (!expr_gen.valid_operator(o0,f0))
return error_node();
else if (!expr_gen.valid_operator(o1,f1))
return error_node();
@@ -33254,14 +33844,18 @@
expression_node_ptr result = error_node();
- if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,v2,v3,result))
+ const bool synthesis_result =
+ synthesize_sf4ext_expression::template compile<T0, T1, T2, T3>
+ (expr_gen,id(expr_gen, o0, o1, o2), v0, v1, v2, v3, result);
+
+ if (synthesis_result)
return result;
else if (!expr_gen.valid_operator(o0,f0))
return error_node();
exprtk_debug(("v0 o0 (v1 o1 (v2 o2 v3))\n"));
- return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,v2,v3,f0,f1,f2);
+ return node_type::allocate(*(expr_gen.node_allocator_), v0, v1, v2, v3, f0, f1, f2);
}
static inline std::string id(expression_generator<Type>& expr_gen,
@@ -34245,7 +34839,9 @@
struct synthesize_vococov_expression2
{
typedef typename vococov_t::type2 node_type;
- static inline expression_node_ptr process(expression_generator<Type>&, const details::operator_type&, expression_node_ptr (&)[2])
+ static inline expression_node_ptr process(expression_generator<Type>&,
+ const details::operator_type&,
+ expression_node_ptr (&)[2])
{
// v0 o0 ((c0 o1 c1) o2 v1) - Not possible
exprtk_debug(("v0 o0 ((c0 o1 c1) o2 v1) - Not possible\n"));
@@ -34253,7 +34849,9 @@
}
static inline std::string id(expression_generator<Type>&,
- const details::operator_type, const details::operator_type, const details::operator_type)
+ const details::operator_type,
+ const details::operator_type,
+ const details::operator_type)
{
return "INVALID";
}
@@ -35287,7 +35885,9 @@
struct synthesize_vococov_expression4
{
typedef typename vococov_t::type4 node_type;
- static inline expression_node_ptr process(expression_generator<Type>&, const details::operator_type&, expression_node_ptr (&)[2])
+ static inline expression_node_ptr process(expression_generator<Type>&,
+ const details::operator_type&,
+ expression_node_ptr (&)[2])
{
// ((v0 o0 (c0 o1 c1)) o2 v1) - Not possible
exprtk_debug(("((v0 o0 (c0 o1 c1)) o2 v1) - Not possible\n"));
@@ -35295,7 +35895,9 @@
}
static inline std::string id(expression_generator<Type>&,
- const details::operator_type, const details::operator_type, const details::operator_type)
+ const details::operator_type,
+ const details::operator_type,
+ const details::operator_type)
{
return "INVALID";
}
@@ -35378,16 +35980,16 @@
#ifndef exprtk_disable_string_capabilities
- #define string_opr_switch_statements \
- case_stmt(details:: e_lt ,details:: lt_op) \
- case_stmt(details:: e_lte ,details:: lte_op) \
- case_stmt(details:: e_gt ,details:: gt_op) \
- case_stmt(details:: e_gte ,details:: gte_op) \
- case_stmt(details:: e_eq ,details:: eq_op) \
- case_stmt(details:: e_ne ,details:: ne_op) \
- case_stmt(details::e_in ,details:: in_op) \
- case_stmt(details::e_like ,details:: like_op) \
- case_stmt(details::e_ilike,details::ilike_op) \
+ #define string_opr_switch_statements \
+ case_stmt(details::e_lt , details::lt_op ) \
+ case_stmt(details::e_lte , details::lte_op ) \
+ case_stmt(details::e_gt , details::gt_op ) \
+ case_stmt(details::e_gte , details::gte_op ) \
+ case_stmt(details::e_eq , details::eq_op ) \
+ case_stmt(details::e_ne , details::ne_op ) \
+ case_stmt(details::e_in , details::in_op ) \
+ case_stmt(details::e_like , details::like_op ) \
+ case_stmt(details::e_ilike , details::ilike_op) \
template <typename T0, typename T1>
inline expression_node_ptr synthesize_str_xrox_expression_impl(const details::operator_type& opr,
@@ -35396,7 +35998,7 @@
{
switch (opr)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
allocate_ttt<typename details::str_xrox_node<Type,T0,T1,range_t,op1<Type> >,T0,T1> \
(s0, s1, rp0); \
@@ -35414,7 +36016,7 @@
{
switch (opr)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
allocate_ttt<typename details::str_xoxr_node<Type,T0,T1,range_t,op1<Type> >,T0,T1> \
(s0, s1, rp1); \
@@ -35432,7 +36034,7 @@
{
switch (opr)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
allocate_tttt<typename details::str_xroxr_node<Type,T0,T1,range_t,op1<Type> >,T0,T1> \
(s0, s1, rp0, rp1); \
@@ -35448,7 +36050,7 @@
{
switch (opr)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
allocate_tt<typename details::sos_node<Type,T0,T1,op1<Type> >,T0,T1>(s0, s1); \
@@ -35474,7 +36076,7 @@
static_cast<details::string_range_node<Type>*>(branch[0])->range_ref().clear();
- free_node(*node_allocator_,branch[0]);
+ details::free_node(*node_allocator_,branch[0]);
return synthesize_str_xrox_expression_impl<std::string&,std::string&>(opr, s0, s1, rp0);
}
@@ -35487,7 +36089,7 @@
static_cast<details::string_range_node<Type>*>(branch[1])->range_ref().clear();
- free_node(*node_allocator_,branch[1]);
+ details::free_node(*node_allocator_,branch[1]);
return synthesize_str_xoxr_expression_impl<std::string&,std::string&>(opr, s0, s1, rp1);
}
@@ -35500,7 +36102,7 @@
static_cast<details::const_string_range_node<Type>*>(branch[1])->range_ref().clear();
- free_node(*node_allocator_,branch[1]);
+ details::free_node(*node_allocator_,branch[1]);
return synthesize_str_xoxr_expression_impl<std::string&, const std::string>(opr, s0, s1, rp1);
}
@@ -35534,7 +36136,7 @@
inline expression_node_ptr synthesize_csos_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2])
{
std::string s0 = static_cast<details::string_literal_node<Type>*>(branch[0])->str();
- std::string& s1 = static_cast< details::stringvar_node<Type>*>(branch[1])->ref();
+ std::string& s1 = static_cast<details::stringvar_node<Type>* >(branch[1])->ref();
details::free_node(*node_allocator_,branch[0]);
@@ -35543,9 +36145,9 @@
inline expression_node_ptr synthesize_csosr_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2])
{
- std::string s0 = static_cast<details::string_literal_node<Type>*>(branch[0])->str ();
- std::string& s1 = static_cast<details::string_range_node<Type>*> (branch[1])->ref ();
- range_t rp1 = static_cast<details::string_range_node<Type>*> (branch[1])->range();
+ std::string s0 = static_cast<details::string_literal_node<Type>*>(branch[0])->str ();
+ std::string& s1 = static_cast<details::string_range_node<Type>* >(branch[1])->ref ();
+ range_t rp1 = static_cast<details::string_range_node<Type>* >(branch[1])->range();
static_cast<details::string_range_node<Type>*>(branch[1])->range_ref().clear();
@@ -35557,9 +36159,9 @@
inline expression_node_ptr synthesize_srocs_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2])
{
- std::string& s0 = static_cast<details::string_range_node<Type>*> (branch[0])->ref ();
+ std::string& s0 = static_cast<details::string_range_node<Type>* >(branch[0])->ref ();
std::string s1 = static_cast<details::string_literal_node<Type>*>(branch[1])->str ();
- range_t rp0 = static_cast<details::string_range_node<Type>*> (branch[0])->range();
+ range_t rp0 = static_cast<details::string_range_node<Type>* >(branch[0])->range();
static_cast<details::string_range_node<Type>*>(branch[0])->range_ref().clear();
@@ -35571,9 +36173,9 @@
inline expression_node_ptr synthesize_srocsr_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2])
{
- std::string& s0 = static_cast<details::string_range_node<Type>*> (branch[0])->ref ();
+ std::string& s0 = static_cast<details::string_range_node<Type>* >(branch[0])->ref ();
std::string s1 = static_cast<details::const_string_range_node<Type>*>(branch[1])->str ();
- range_t rp0 = static_cast<details::string_range_node<Type>*> (branch[0])->range();
+ range_t rp0 = static_cast<details::string_range_node<Type>* >(branch[0])->range();
range_t rp1 = static_cast<details::const_string_range_node<Type>*>(branch[1])->range();
static_cast<details::string_range_node<Type>*> (branch[0])->range_ref().clear();
@@ -35618,14 +36220,14 @@
inline expression_node_ptr synthesize_csocsr_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2])
{
- const std::string s0 = static_cast<details::string_literal_node<Type>*> (branch[0])->str ();
+ const std::string s0 = static_cast<details::string_literal_node<Type>* >(branch[0])->str ();
std::string s1 = static_cast<details::const_string_range_node<Type>*>(branch[1])->str ();
range_t rp1 = static_cast<details::const_string_range_node<Type>*>(branch[1])->range();
static_cast<details::const_string_range_node<Type>*>(branch[1])->range_ref().clear();
- free_node(*node_allocator_,branch[0]);
- free_node(*node_allocator_,branch[1]);
+ details::free_node(*node_allocator_,branch[0]);
+ details::free_node(*node_allocator_,branch[1]);
return synthesize_str_xoxr_expression_impl<const std::string, const std::string>(opr, s0, s1, rp1);
}
@@ -35633,12 +36235,12 @@
inline expression_node_ptr synthesize_csros_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2])
{
std::string s0 = static_cast<details::const_string_range_node<Type>*>(branch[0])->str ();
- std::string& s1 = static_cast<details::stringvar_node<Type>*> (branch[1])->ref ();
+ std::string& s1 = static_cast<details::stringvar_node<Type>* >(branch[1])->ref ();
range_t rp0 = static_cast<details::const_string_range_node<Type>*>(branch[0])->range();
static_cast<details::const_string_range_node<Type>*>(branch[0])->range_ref().clear();
- free_node(*node_allocator_,branch[0]);
+ details::free_node(*node_allocator_,branch[0]);
return synthesize_str_xrox_expression_impl<const std::string,std::string&>(opr, s0, s1, rp0);
}
@@ -35646,15 +36248,15 @@
inline expression_node_ptr synthesize_csrosr_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2])
{
const std::string s0 = static_cast<details::const_string_range_node<Type>*>(branch[0])->str ();
- std::string& s1 = static_cast<details::string_range_node<Type>*> (branch[1])->ref ();
+ std::string& s1 = static_cast<details::string_range_node<Type>* >(branch[1])->ref ();
const range_t rp0 = static_cast<details::const_string_range_node<Type>*>(branch[0])->range();
- const range_t rp1 = static_cast<details::string_range_node<Type>*> (branch[1])->range();
+ const range_t rp1 = static_cast<details::string_range_node<Type>* >(branch[1])->range();
static_cast<details::const_string_range_node<Type>*>(branch[0])->range_ref().clear();
static_cast<details::string_range_node<Type>*> (branch[1])->range_ref().clear();
- free_node(*node_allocator_,branch[0]);
- free_node(*node_allocator_,branch[1]);
+ details::free_node(*node_allocator_,branch[0]);
+ details::free_node(*node_allocator_,branch[1]);
return synthesize_str_xroxr_expression_impl<const std::string,std::string&>(opr, s0, s1, rp0, rp1);
}
@@ -35662,7 +36264,7 @@
inline expression_node_ptr synthesize_csrocs_expression(const details::operator_type& opr, expression_node_ptr (&branch)[2])
{
const std::string s0 = static_cast<details::const_string_range_node<Type>*>(branch[0])->str ();
- const std::string s1 = static_cast<details::string_literal_node<Type>*> (branch[1])->str ();
+ const std::string s1 = static_cast<details::string_literal_node<Type>* >(branch[1])->str ();
const range_t rp0 = static_cast<details::const_string_range_node<Type>*>(branch[0])->range();
static_cast<details::const_string_range_node<Type>*>(branch[0])->range_ref().clear();
@@ -35691,7 +36293,7 @@
{
switch (opr)
{
- #define case_stmt(op0,op1) \
+ #define case_stmt(op0, op1) \
case op0 : return node_allocator_-> \
allocate_ttt<typename details::str_sogens_node<Type,op1<Type> > > \
(opr, branch[0], branch[1]); \
@@ -35753,28 +36355,28 @@
}
else if (b0_is_s)
{
- if (b1_is_s ) return synthesize_sos_expression (opr,branch);
+ if (b1_is_s ) return synthesize_sos_expression (opr,branch);
else if (b1_is_cs ) return synthesize_socs_expression (opr,branch);
else if (b1_is_sr ) return synthesize_sosr_expression (opr,branch);
else if (b1_is_csr) return synthesize_socsr_expression (opr,branch);
}
else if (b0_is_cs)
{
- if (b1_is_s ) return synthesize_csos_expression (opr,branch);
+ if (b1_is_s ) return synthesize_csos_expression (opr,branch);
else if (b1_is_cs ) return synthesize_csocs_expression (opr,branch);
else if (b1_is_sr ) return synthesize_csosr_expression (opr,branch);
else if (b1_is_csr) return synthesize_csocsr_expression(opr,branch);
}
else if (b0_is_sr)
{
- if (b1_is_s ) return synthesize_sros_expression (opr,branch);
+ if (b1_is_s ) return synthesize_sros_expression (opr,branch);
else if (b1_is_sr ) return synthesize_srosr_expression (opr,branch);
else if (b1_is_cs ) return synthesize_srocs_expression (opr,branch);
else if (b1_is_csr) return synthesize_srocsr_expression(opr,branch);
}
else if (b0_is_csr)
{
- if (b1_is_s ) return synthesize_csros_expression (opr,branch);
+ if (b1_is_s ) return synthesize_csros_expression (opr,branch);
else if (b1_is_sr ) return synthesize_csrosr_expression (opr,branch);
else if (b1_is_cs ) return synthesize_csrocs_expression (opr,branch);
else if (b1_is_csr) return synthesize_csrocsr_expression(opr,branch);
@@ -35838,7 +36440,7 @@
)
{
std::string s0 = static_cast<details::string_literal_node<Type>*>(branch[0])->str();
- std::string& s1 = static_cast< details::stringvar_node<Type>*>(branch[1])->ref();
+ std::string& s1 = static_cast<details::stringvar_node<Type>* >(branch[1])->ref();
std::string s2 = static_cast<details::string_literal_node<Type>*>(branch[2])->str();
typedef typename details::sosos_node<Type, std::string, std::string&, std::string, details::inrange_op<Type> > inrange_t;
@@ -35854,9 +36456,9 @@
details::is_string_node(branch[2])
)
{
- std::string& s0 = static_cast< details::stringvar_node<Type>*>(branch[0])->ref();
+ std::string& s0 = static_cast<details::stringvar_node<Type>* >(branch[0])->ref();
std::string s1 = static_cast<details::string_literal_node<Type>*>(branch[1])->str();
- std::string& s2 = static_cast< details::stringvar_node<Type>*>(branch[2])->ref();
+ std::string& s2 = static_cast<details::stringvar_node<Type>* >(branch[2])->ref();
typedef typename details::sosos_node<Type, std::string&, std::string, std::string&, details::inrange_op<Type> > inrange_t;
@@ -35870,8 +36472,8 @@
details::is_const_string_node(branch[2])
)
{
- std::string& s0 = static_cast< details::stringvar_node<Type>*>(branch[0])->ref();
- std::string& s1 = static_cast< details::stringvar_node<Type>*>(branch[1])->ref();
+ std::string& s0 = static_cast<details::stringvar_node<Type>* >(branch[0])->ref();
+ std::string& s1 = static_cast<details::stringvar_node<Type>* >(branch[1])->ref();
std::string s2 = static_cast<details::string_literal_node<Type>*>(branch[2])->str();
typedef typename details::sosos_node<Type, std::string&, std::string&, std::string, details::inrange_op<Type> > inrange_t;
@@ -35887,8 +36489,8 @@
)
{
std::string s0 = static_cast<details::string_literal_node<Type>*>(branch[0])->str();
- std::string& s1 = static_cast< details::stringvar_node<Type>*>(branch[1])->ref();
- std::string& s2 = static_cast< details::stringvar_node<Type>*>(branch[2])->ref();
+ std::string& s1 = static_cast<details::stringvar_node<Type>* >(branch[1])->ref();
+ std::string& s2 = static_cast<details::stringvar_node<Type>* >(branch[2])->ref();
typedef typename details::sosos_node<Type, std::string, std::string&, std::string&, details::inrange_op<Type> > inrange_t;
@@ -36089,7 +36691,7 @@
sf3_map_t* sf3_map_;
sf4_map_t* sf4_map_;
parser_t* parser_;
- };
+ }; // class expression_generator
inline void set_error(const parser_error::type& error_type)
{
@@ -36179,48 +36781,48 @@
inline void load_unary_operations_map(unary_op_map_t& m)
{
- #define register_unary_op(Op,UnaryFunctor) \
+ #define register_unary_op(Op, UnaryFunctor) \
m.insert(std::make_pair(Op,UnaryFunctor<T>::process)); \
- register_unary_op(details:: e_abs, details:: abs_op)
- register_unary_op(details:: e_acos, details:: acos_op)
- register_unary_op(details::e_acosh, details::acosh_op)
- register_unary_op(details:: e_asin, details:: asin_op)
- register_unary_op(details::e_asinh, details::asinh_op)
- register_unary_op(details::e_atanh, details::atanh_op)
- register_unary_op(details:: e_ceil, details:: ceil_op)
- register_unary_op(details:: e_cos, details:: cos_op)
- register_unary_op(details:: e_cosh, details:: cosh_op)
- register_unary_op(details:: e_exp, details:: exp_op)
- register_unary_op(details::e_expm1, details::expm1_op)
- register_unary_op(details::e_floor, details::floor_op)
- register_unary_op(details:: e_log, details:: log_op)
- register_unary_op(details::e_log10, details::log10_op)
- register_unary_op(details:: e_log2, details:: log2_op)
- register_unary_op(details::e_log1p, details::log1p_op)
- register_unary_op(details:: e_neg, details:: neg_op)
- register_unary_op(details:: e_pos, details:: pos_op)
- register_unary_op(details::e_round, details::round_op)
- register_unary_op(details:: e_sin, details:: sin_op)
- register_unary_op(details:: e_sinc, details:: sinc_op)
- register_unary_op(details:: e_sinh, details:: sinh_op)
- register_unary_op(details:: e_sqrt, details:: sqrt_op)
- register_unary_op(details:: e_tan, details:: tan_op)
- register_unary_op(details:: e_tanh, details:: tanh_op)
- register_unary_op(details:: e_cot, details:: cot_op)
- register_unary_op(details:: e_sec, details:: sec_op)
- register_unary_op(details:: e_csc, details:: csc_op)
- register_unary_op(details:: e_r2d, details:: r2d_op)
- register_unary_op(details:: e_d2r, details:: d2r_op)
- register_unary_op(details:: e_d2g, details:: d2g_op)
- register_unary_op(details:: e_g2d, details:: g2d_op)
- register_unary_op(details:: e_notl, details:: notl_op)
- register_unary_op(details:: e_sgn, details:: sgn_op)
- register_unary_op(details:: e_erf, details:: erf_op)
- register_unary_op(details:: e_erfc, details:: erfc_op)
- register_unary_op(details:: e_ncdf, details:: ncdf_op)
- register_unary_op(details:: e_frac, details:: frac_op)
- register_unary_op(details::e_trunc, details::trunc_op)
+ register_unary_op(details::e_abs , details::abs_op )
+ register_unary_op(details::e_acos , details::acos_op )
+ register_unary_op(details::e_acosh , details::acosh_op)
+ register_unary_op(details::e_asin , details::asin_op )
+ register_unary_op(details::e_asinh , details::asinh_op)
+ register_unary_op(details::e_atanh , details::atanh_op)
+ register_unary_op(details::e_ceil , details::ceil_op )
+ register_unary_op(details::e_cos , details::cos_op )
+ register_unary_op(details::e_cosh , details::cosh_op )
+ register_unary_op(details::e_exp , details::exp_op )
+ register_unary_op(details::e_expm1 , details::expm1_op)
+ register_unary_op(details::e_floor , details::floor_op)
+ register_unary_op(details::e_log , details::log_op )
+ register_unary_op(details::e_log10 , details::log10_op)
+ register_unary_op(details::e_log2 , details::log2_op )
+ register_unary_op(details::e_log1p , details::log1p_op)
+ register_unary_op(details::e_neg , details::neg_op )
+ register_unary_op(details::e_pos , details::pos_op )
+ register_unary_op(details::e_round , details::round_op)
+ register_unary_op(details::e_sin , details::sin_op )
+ register_unary_op(details::e_sinc , details::sinc_op )
+ register_unary_op(details::e_sinh , details::sinh_op )
+ register_unary_op(details::e_sqrt , details::sqrt_op )
+ register_unary_op(details::e_tan , details::tan_op )
+ register_unary_op(details::e_tanh , details::tanh_op )
+ register_unary_op(details::e_cot , details::cot_op )
+ register_unary_op(details::e_sec , details::sec_op )
+ register_unary_op(details::e_csc , details::csc_op )
+ register_unary_op(details::e_r2d , details::r2d_op )
+ register_unary_op(details::e_d2r , details::d2r_op )
+ register_unary_op(details::e_d2g , details::d2g_op )
+ register_unary_op(details::e_g2d , details::g2d_op )
+ register_unary_op(details::e_notl , details::notl_op )
+ register_unary_op(details::e_sgn , details::sgn_op )
+ register_unary_op(details::e_erf , details::erf_op )
+ register_unary_op(details::e_erfc , details::erfc_op )
+ register_unary_op(details::e_ncdf , details::ncdf_op )
+ register_unary_op(details::e_frac , details::frac_op )
+ register_unary_op(details::e_trunc , details::trunc_op)
#undef register_unary_op
}
@@ -36228,27 +36830,27 @@
{
typedef typename binary_op_map_t::value_type value_type;
- #define register_binary_op(Op,BinaryFunctor) \
+ #define register_binary_op(Op, BinaryFunctor) \
m.insert(value_type(Op,BinaryFunctor<T>::process)); \
- register_binary_op(details:: e_add, details:: add_op)
- register_binary_op(details:: e_sub, details:: sub_op)
- register_binary_op(details:: e_mul, details:: mul_op)
- register_binary_op(details:: e_div, details:: div_op)
- register_binary_op(details:: e_mod, details:: mod_op)
- register_binary_op(details:: e_pow, details:: pow_op)
- register_binary_op(details:: e_lt, details:: lt_op)
- register_binary_op(details:: e_lte, details:: lte_op)
- register_binary_op(details:: e_gt, details:: gt_op)
- register_binary_op(details:: e_gte, details:: gte_op)
- register_binary_op(details:: e_eq, details:: eq_op)
- register_binary_op(details:: e_ne, details:: ne_op)
- register_binary_op(details:: e_and, details:: and_op)
- register_binary_op(details::e_nand, details::nand_op)
- register_binary_op(details:: e_or, details:: or_op)
- register_binary_op(details:: e_nor, details:: nor_op)
- register_binary_op(details:: e_xor, details:: xor_op)
- register_binary_op(details::e_xnor, details::xnor_op)
+ register_binary_op(details::e_add , details::add_op )
+ register_binary_op(details::e_sub , details::sub_op )
+ register_binary_op(details::e_mul , details::mul_op )
+ register_binary_op(details::e_div , details::div_op )
+ register_binary_op(details::e_mod , details::mod_op )
+ register_binary_op(details::e_pow , details::pow_op )
+ register_binary_op(details::e_lt , details::lt_op )
+ register_binary_op(details::e_lte , details::lte_op )
+ register_binary_op(details::e_gt , details::gt_op )
+ register_binary_op(details::e_gte , details::gte_op )
+ register_binary_op(details::e_eq , details::eq_op )
+ register_binary_op(details::e_ne , details::ne_op )
+ register_binary_op(details::e_and , details::and_op )
+ register_binary_op(details::e_nand , details::nand_op)
+ register_binary_op(details::e_or , details::or_op )
+ register_binary_op(details::e_nor , details::nor_op )
+ register_binary_op(details::e_xor , details::xor_op )
+ register_binary_op(details::e_xnor , details::xnor_op)
#undef register_binary_op
}
@@ -36256,27 +36858,27 @@
{
typedef typename inv_binary_op_map_t::value_type value_type;
- #define register_binary_op(Op,BinaryFunctor) \
+ #define register_binary_op(Op, BinaryFunctor) \
m.insert(value_type(BinaryFunctor<T>::process,Op)); \
- register_binary_op(details:: e_add, details:: add_op)
- register_binary_op(details:: e_sub, details:: sub_op)
- register_binary_op(details:: e_mul, details:: mul_op)
- register_binary_op(details:: e_div, details:: div_op)
- register_binary_op(details:: e_mod, details:: mod_op)
- register_binary_op(details:: e_pow, details:: pow_op)
- register_binary_op(details:: e_lt, details:: lt_op)
- register_binary_op(details:: e_lte, details:: lte_op)
- register_binary_op(details:: e_gt, details:: gt_op)
- register_binary_op(details:: e_gte, details:: gte_op)
- register_binary_op(details:: e_eq, details:: eq_op)
- register_binary_op(details:: e_ne, details:: ne_op)
- register_binary_op(details:: e_and, details:: and_op)
- register_binary_op(details::e_nand, details::nand_op)
- register_binary_op(details:: e_or, details:: or_op)
- register_binary_op(details:: e_nor, details:: nor_op)
- register_binary_op(details:: e_xor, details:: xor_op)
- register_binary_op(details::e_xnor, details::xnor_op)
+ register_binary_op(details::e_add , details::add_op )
+ register_binary_op(details::e_sub , details::sub_op )
+ register_binary_op(details::e_mul , details::mul_op )
+ register_binary_op(details::e_div , details::div_op )
+ register_binary_op(details::e_mod , details::mod_op )
+ register_binary_op(details::e_pow , details::pow_op )
+ register_binary_op(details::e_lt , details::lt_op )
+ register_binary_op(details::e_lte , details::lte_op )
+ register_binary_op(details::e_gt , details::gt_op )
+ register_binary_op(details::e_gte , details::gte_op )
+ register_binary_op(details::e_eq , details::eq_op )
+ register_binary_op(details::e_ne , details::ne_op )
+ register_binary_op(details::e_and , details::and_op )
+ register_binary_op(details::e_nand , details::nand_op)
+ register_binary_op(details::e_or , details::or_op )
+ register_binary_op(details::e_nor , details::nor_op )
+ register_binary_op(details::e_xor , details::xor_op )
+ register_binary_op(details::e_xnor , details::xnor_op)
#undef register_binary_op
}
@@ -36369,8 +36971,8 @@
private:
- parser(const parser<T>&);
- parser<T>& operator=(const parser<T>&);
+ parser(const parser<T>&) exprtk_delete;
+ parser<T>& operator=(const parser<T>&) exprtk_delete;
settings_store settings_;
expression_generator<T> expression_generator_;
@@ -36408,7 +37010,7 @@
template <typename ParserType>
friend void details::disable_type_checking(ParserType& p);
- };
+ }; // class parser
namespace details
{
@@ -36416,8 +37018,8 @@
struct collector_helper
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
typedef typename parser_t::dependent_entity_collector::symbol_t symbol_t;
typedef typename parser_t::unknown_symbol_resolver usr_t;
@@ -36670,9 +37272,9 @@
x = x_init + _2h;
const T y0 = e.value();
- x = x_init + h;
+ x = x_init + h;
const T y1 = e.value();
- x = x_init - h;
+ x = x_init - h;
const T y2 = e.value();
x = x_init - _2h;
const T y3 = e.value();
@@ -36692,9 +37294,9 @@
const T y = e.value();
x = x_init + _2h;
const T y0 = e.value();
- x = x_init + h;
+ x = x_init + h;
const T y1 = e.value();
- x = x_init - h;
+ x = x_init - h;
const T y2 = e.value();
x = x_init - _2h;
const T y3 = e.value();
@@ -36713,9 +37315,9 @@
x = x_init + _2h;
const T y0 = e.value();
- x = x_init + h;
+ x = x_init + h;
const T y1 = e.value();
- x = x_init - h;
+ x = x_init - h;
const T y2 = e.value();
x = x_init - _2h;
const T y3 = e.value();
@@ -37081,8 +37683,7 @@
disable_has_side_effects(*this);
}
- virtual ~polynomial()
- {}
+ virtual ~polynomial() {}
#define poly_rtrn(NN) \
return (NN != N) ? std::numeric_limits<T>::quiet_NaN() :
@@ -37102,47 +37703,60 @@
poly_rtrn(3) (poly_impl<T,3>::evaluate(x, c3, c2, c1, c0));
}
- inline virtual T operator() (const T& x, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0)
+ inline virtual T operator() (const T& x, const T& c4, const T& c3, const T& c2, const T& c1,
+ const T& c0)
{
poly_rtrn(4) (poly_impl<T,4>::evaluate(x, c4, c3, c2, c1, c0));
}
- inline virtual T operator() (const T& x, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0)
+ inline virtual T operator() (const T& x, const T& c5, const T& c4, const T& c3, const T& c2,
+ const T& c1, const T& c0)
{
poly_rtrn(5) (poly_impl<T,5>::evaluate(x, c5, c4, c3, c2, c1, c0));
}
- inline virtual T operator() (const T& x, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0)
+ inline virtual T operator() (const T& x, const T& c6, const T& c5, const T& c4, const T& c3,
+ const T& c2, const T& c1, const T& c0)
{
poly_rtrn(6) (poly_impl<T,6>::evaluate(x, c6, c5, c4, c3, c2, c1, c0));
}
- inline virtual T operator() (const T& x, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0)
+ inline virtual T operator() (const T& x, const T& c7, const T& c6, const T& c5, const T& c4,
+ const T& c3, const T& c2, const T& c1, const T& c0)
{
poly_rtrn(7) (poly_impl<T,7>::evaluate(x, c7, c6, c5, c4, c3, c2, c1, c0));
}
- inline virtual T operator() (const T& x, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0)
+ inline virtual T operator() (const T& x, const T& c8, const T& c7, const T& c6, const T& c5,
+ const T& c4, const T& c3, const T& c2, const T& c1, const T& c0)
{
poly_rtrn(8) (poly_impl<T,8>::evaluate(x, c8, c7, c6, c5, c4, c3, c2, c1, c0));
}
- inline virtual T operator() (const T& x, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0)
+ inline virtual T operator() (const T& x, const T& c9, const T& c8, const T& c7, const T& c6,
+ const T& c5, const T& c4, const T& c3, const T& c2, const T& c1,
+ const T& c0)
{
poly_rtrn(9) (poly_impl<T,9>::evaluate(x, c9, c8, c7, c6, c5, c4, c3, c2, c1, c0));
}
- inline virtual T operator() (const T& x, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0)
+ inline virtual T operator() (const T& x, const T& c10, const T& c9, const T& c8, const T& c7,
+ const T& c6, const T& c5, const T& c4, const T& c3, const T& c2,
+ const T& c1, const T& c0)
{
poly_rtrn(10) (poly_impl<T,10>::evaluate(x, c10, c9, c8, c7, c6, c5, c4, c3, c2, c1, c0));
}
- inline virtual T operator() (const T& x, const T& c11, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0)
+ inline virtual T operator() (const T& x, const T& c11, const T& c10, const T& c9, const T& c8,
+ const T& c7, const T& c6, const T& c5, const T& c4, const T& c3,
+ const T& c2, const T& c1, const T& c0)
{
poly_rtrn(11) (poly_impl<T,11>::evaluate(x, c11, c10, c9, c8, c7, c6, c5, c4, c3, c2, c1, c0));
}
- inline virtual T operator() (const T& x, const T& c12, const T& c11, const T& c10, const T& c9, const T& c8, const T& c7, const T& c6, const T& c5, const T& c4, const T& c3, const T& c2, const T& c1, const T& c0)
+ inline virtual T operator() (const T& x, const T& c12, const T& c11, const T& c10, const T& c9,
+ const T& c8, const T& c7, const T& c6, const T& c5, const T& c4,
+ const T& c3, const T& c2, const T& c1, const T& c0)
{
poly_rtrn(12) (poly_impl<T,12>::evaluate(x, c12, c11, c10, c9, c8, c7, c6, c5, c4, c3, c2, c1, c0));
}
@@ -37186,15 +37800,15 @@
function(const std::string& name,
const std::string& expression)
- : name_(name),
- expression_(expression)
+ : name_(name)
+ , expression_(expression)
{}
function(const std::string& name,
const std::string& expression,
const std::string& v0)
- : name_(name),
- expression_(expression)
+ : name_(name)
+ , expression_(expression)
{
v_.push_back(v0);
}
@@ -37202,8 +37816,8 @@
function(const std::string& name,
const std::string& expression,
const std::string& v0, const std::string& v1)
- : name_(name),
- expression_(expression)
+ : name_(name)
+ , expression_(expression)
{
v_.push_back(v0); v_.push_back(v1);
}
@@ -37212,8 +37826,8 @@
const std::string& expression,
const std::string& v0, const std::string& v1,
const std::string& v2)
- : name_(name),
- expression_(expression)
+ : name_(name)
+ , expression_(expression)
{
v_.push_back(v0); v_.push_back(v1);
v_.push_back(v2);
@@ -37223,8 +37837,8 @@
const std::string& expression,
const std::string& v0, const std::string& v1,
const std::string& v2, const std::string& v3)
- : name_(name),
- expression_(expression)
+ : name_(name)
+ , expression_(expression)
{
v_.push_back(v0); v_.push_back(v1);
v_.push_back(v2); v_.push_back(v3);
@@ -37235,8 +37849,8 @@
const std::string& v0, const std::string& v1,
const std::string& v2, const std::string& v3,
const std::string& v4)
- : name_(name),
- expression_(expression)
+ : name_(name)
+ , expression_(expression)
{
v_.push_back(v0); v_.push_back(v1);
v_.push_back(v2); v_.push_back(v3);
@@ -37280,50 +37894,52 @@
using exprtk::ifunction<T>::operator();
base_func(const std::size_t& pc = 0)
- : exprtk::ifunction<T>(pc),
- local_var_stack_size(0),
- stack_depth(0)
+ : exprtk::ifunction<T>(pc)
+ , local_var_stack_size(0)
+ , stack_depth(0)
{
v.resize(pc);
}
- virtual ~base_func()
- {}
+ virtual ~base_func() {}
+
+ #define assign(Index) \
+ (*v[Index]) = v##Index; \
inline void update(const T& v0)
{
- (*v[0]) = v0;
+ assign(0)
}
inline void update(const T& v0, const T& v1)
{
- (*v[0]) = v0; (*v[1]) = v1;
+ assign(0) assign(1)
}
inline void update(const T& v0, const T& v1, const T& v2)
{
- (*v[0]) = v0; (*v[1]) = v1;
- (*v[2]) = v2;
+ assign(0) assign(1)
+ assign(2)
}
inline void update(const T& v0, const T& v1, const T& v2, const T& v3)
{
- (*v[0]) = v0; (*v[1]) = v1;
- (*v[2]) = v2; (*v[3]) = v3;
+ assign(0) assign(1)
+ assign(2) assign(3)
}
inline void update(const T& v0, const T& v1, const T& v2, const T& v3, const T& v4)
{
- (*v[0]) = v0; (*v[1]) = v1;
- (*v[2]) = v2; (*v[3]) = v3;
- (*v[4]) = v4;
+ assign(0) assign(1)
+ assign(2) assign(3)
+ assign(4)
}
inline void update(const T& v0, const T& v1, const T& v2, const T& v3, const T& v4, const T& v5)
{
- (*v[0]) = v0; (*v[1]) = v1;
- (*v[2]) = v2; (*v[3]) = v3;
- (*v[4]) = v4; (*v[5]) = v5;
+ assign(0) assign(1)
+ assign(2) assign(3)
+ assign(4) assign(5)
}
inline function_t& setup(expression_t& expr)
@@ -37501,15 +38117,23 @@
template <typename BaseFuncType>
struct scoped_bft
{
- scoped_bft(BaseFuncType& bft) : bft_(bft) { bft_.pre (); }
- ~scoped_bft() { bft_.post(); }
+ explicit scoped_bft(BaseFuncType& bft)
+ : bft_(bft)
+ {
+ bft_.pre ();
+ }
+
+ ~scoped_bft()
+ {
+ bft_.post();
+ }
BaseFuncType& bft_;
private:
- scoped_bft(scoped_bft&);
- scoped_bft& operator=(scoped_bft&);
+ scoped_bft(const scoped_bft&) exprtk_delete;
+ scoped_bft& operator=(const scoped_bft&) exprtk_delete;
};
struct func_1param : public base_func
@@ -37654,7 +38278,7 @@
remove(name, var_list.size());
}
- if (compile_expression(name,expression,var_list))
+ if (compile_expression(name, expression, var_list))
{
const std::size_t n = var_list.size();
@@ -37675,15 +38299,15 @@
function_compositor()
: parser_(settings_t::compile_all_opts +
- settings_t::e_disable_zero_return),
- fp_map_(7)
+ settings_t::e_disable_zero_return)
+ , fp_map_(7)
{}
function_compositor(const symbol_table_t& st)
- : symbol_table_(st),
- parser_(settings_t::compile_all_opts +
- settings_t::e_disable_zero_return),
- fp_map_(7)
+ : symbol_table_(st)
+ , parser_(settings_t::compile_all_opts +
+ settings_t::e_disable_zero_return)
+ , fp_map_(7)
{}
~function_compositor()
@@ -37696,6 +38320,11 @@
return symbol_table_;
}
+ inline const symbol_table_t& symbol_table() const
+ {
+ return symbol_table_;
+ }
+
inline void add_auxiliary_symtab(symbol_table_t& symtab)
{
auxiliary_symtab_list_.push_back(&symtab);
@@ -37906,7 +38535,7 @@
std::map<std::string,expression_t> expr_map_;
std::vector<funcparam_t> fp_map_;
std::vector<symbol_table_t*> auxiliary_symtab_list_;
- };
+ }; // class function_compositor
template <typename T>
inline bool pgo_primer()
@@ -38076,7 +38705,7 @@
{
const T v = T(123.456 + i);
- if (details::is_true(details::numeric::nequal(details::numeric::fast_exp<T, 1>::result(v),details::numeric::pow(v,T( 1)))))
+ if (details::is_true(details::numeric::nequal(details::numeric::fast_exp<T, 1>::result(v),details::numeric::pow(v,T(1)))))
return false;
#define else_stmt(N) \
@@ -38157,6 +38786,7 @@
{
start_time_.tv_sec = 0;
start_time_.tv_usec = 0;
+
stop_time_.tv_sec = 0;
stop_time_.tv_usec = 0;
}
@@ -38215,6 +38845,17 @@
#endif
};
+ template <typename T>
+ struct type_defs
+ {
+ typedef symbol_table<T> symbol_table_t;
+ typedef expression<T> expression_t;
+ typedef parser<T> parser_t;
+ typedef parser_error::type error_t;
+ typedef function_compositor<T> compositor_t;
+ typedef typename compositor_t::function function_t;
+ };
+
} // namespace exprtk
#ifndef exprtk_disable_rtl_io
@@ -38339,7 +38980,7 @@
bool register_package(exprtk::symbol_table<T>& symtab)
{
- #define exprtk_register_function(FunctionName,FunctionType) \
+ #define exprtk_register_function(FunctionName, FunctionType) \
if (!symtab.add_function(FunctionName,FunctionType)) \
{ \
exprtk_debug(( \
@@ -38348,7 +38989,7 @@
return false; \
} \
- exprtk_register_function("print" , p)
+ exprtk_register_function("print" , p )
exprtk_register_function("println", pl)
#undef exprtk_register_function
@@ -38378,9 +39019,9 @@
struct file_descriptor
{
file_descriptor(const std::string& fname, const std::string& access)
- : stream_ptr(0),
- mode(get_file_mode(access)),
- file_name(fname)
+ : stream_ptr(0)
+ , mode(get_file_mode(access))
+ , file_name(fname)
{}
void* stream_ptr;
@@ -38562,11 +39203,13 @@
template <typename T>
file_descriptor* make_handle(T v)
{
- file_descriptor* fd = reinterpret_cast<file_descriptor*>(0);
+ details::file_descriptor* fd = reinterpret_cast<file_descriptor*>(0);
+
+ const std::size_t fd_size = sizeof(details::file_descriptor*);
std::memcpy(reinterpret_cast<char*>(&fd),
reinterpret_cast<const char*>(&v),
- sizeof(fd));
+ fd_size);
return fd;
}
@@ -38625,9 +39268,11 @@
{
T t = T(0);
+ const std::size_t fd_size = sizeof(details::file_descriptor*);
+
std::memcpy(reinterpret_cast<char*>(&t ),
reinterpret_cast<char*>(&fd),
- sizeof(fd));
+ fd_size);
return t;
}
else
@@ -38682,32 +39327,32 @@
{
details::file_descriptor* fd = details::make_handle(scalar_t(parameters[0])());
- std::size_t amount = 0;
-
switch (ps_index)
{
case 0 : {
const string_t buffer(parameters[1]);
- amount = buffer.size();
+ const std::size_t amount = buffer.size();
return T(fd->write(buffer, amount) ? 1 : 0);
}
case 1 : {
const string_t buffer(parameters[1]);
- amount = std::min(buffer.size(),
+ const std::size_t amount =
+ std::min(buffer.size(),
static_cast<std::size_t>(scalar_t(parameters[2])()));
return T(fd->write(buffer, amount) ? 1 : 0);
}
case 2 : {
const vector_t vec(parameters[1]);
- amount = vec.size();
+ const std::size_t amount = vec.size();
return T(fd->write(vec, amount) ? 1 : 0);
}
case 3 : {
const vector_t vec(parameters[1]);
- amount = std::min(vec.size(),
+ const std::size_t amount =
+ std::min(vec.size(),
static_cast<std::size_t>(scalar_t(parameters[2])()));
return T(fd->write(vec, amount) ? 1 : 0);
}
@@ -38739,32 +39384,32 @@
{
details::file_descriptor* fd = details::make_handle(scalar_t(parameters[0])());
- std::size_t amount = 0;
-
switch (ps_index)
{
case 0 : {
string_t buffer(parameters[1]);
- amount = buffer.size();
+ const std::size_t amount = buffer.size();
return T(fd->read(buffer,amount) ? 1 : 0);
}
case 1 : {
string_t buffer(parameters[1]);
- amount = std::min(buffer.size(),
+ const std::size_t amount =
+ std::min(buffer.size(),
static_cast<std::size_t>(scalar_t(parameters[2])()));
return T(fd->read(buffer,amount) ? 1 : 0);
}
case 2 : {
vector_t vec(parameters[1]);
- amount = vec.size();
+ const std::size_t amount = vec.size();
return T(fd->read(vec,amount) ? 1 : 0);
}
case 3 : {
vector_t vec(parameters[1]);
- amount = std::min(vec.size(),
+ const std::size_t amount =
+ std::min(vec.size(),
static_cast<std::size_t>(scalar_t(parameters[2])()));
return T(fd->read(vec,amount) ? 1 : 0);
}
@@ -38828,7 +39473,7 @@
bool register_package(exprtk::symbol_table<T>& symtab)
{
- #define exprtk_register_function(FunctionName,FunctionType) \
+ #define exprtk_register_function(FunctionName, FunctionType) \
if (!symtab.add_function(FunctionName,FunctionType)) \
{ \
exprtk_debug(( \
@@ -38837,12 +39482,12 @@
return false; \
} \
- exprtk_register_function("open" ,o)
- exprtk_register_function("close" ,c)
- exprtk_register_function("write" ,w)
- exprtk_register_function("read" ,r)
- exprtk_register_function("getline",g)
- exprtk_register_function("eof" ,e)
+ exprtk_register_function("open" , o)
+ exprtk_register_function("close" , c)
+ exprtk_register_function("write" , w)
+ exprtk_register_function("read" , r)
+ exprtk_register_function("getline" , g)
+ exprtk_register_function("eof" , e)
#undef exprtk_register_function
return true;
@@ -39193,7 +39838,10 @@
const std::size_t n = std::min(xr1 - xr0 + 1, yr1 - yr0 + 1);
- std::copy(x.begin() + xr0, x.begin() + xr0 + n, y.begin() + yr0);
+ std::copy(
+ x.begin() + xr0,
+ x.begin() + xr0 + n,
+ y.begin() + yr0);
return T(n);
}
@@ -39340,7 +39988,7 @@
)
return T(0);
- const std::size_t dist = r1 - r0 + 1;
+ const std::size_t dist = r1 - r0 + 1;
if (n > dist)
return T(0);
@@ -39398,7 +40046,7 @@
)
return T(0);
- const std::size_t dist = r1 - r0 + 1;
+ const std::size_t dist = r1 - r0 + 1;
if (n > dist)
return T(0);
@@ -39468,9 +40116,15 @@
}
if (ascending)
- std::sort(vec.begin() + r0, vec.begin() + r1 + 1, std::less<T> ());
+ std::sort(
+ vec.begin() + r0,
+ vec.begin() + r1 + 1,
+ std::less<T>());
else
- std::sort(vec.begin() + r0, vec.begin() + r1 + 1, std::greater<T>());
+ std::sort(
+ vec.begin() + r0,
+ vec.begin() + r1 + 1,
+ std::greater<T>());
return T(1);
}
@@ -39512,7 +40166,10 @@
if ((1 == ps_index) && !helper::load_vector_range<T>::process(parameters, r0, r1, 2, 3, 0))
return std::numeric_limits<T>::quiet_NaN();
- std::nth_element(vec.begin() + r0, vec.begin() + r0 + n , vec.begin() + r1 + 1);
+ std::nth_element(
+ vec.begin() + r0,
+ vec.begin() + r0 + n ,
+ vec.begin() + r1 + 1);
return T(1);
}
@@ -39977,7 +40634,7 @@
bool register_package(exprtk::symbol_table<T>& symtab)
{
- #define exprtk_register_function(FunctionName,FunctionType) \
+ #define exprtk_register_function(FunctionName, FunctionType) \
if (!symtab.add_function(FunctionName,FunctionType)) \
{ \
exprtk_debug(( \
@@ -39986,29 +40643,29 @@
return false; \
} \
- exprtk_register_function("all_true" ,at)
- exprtk_register_function("all_false" ,af)
- exprtk_register_function("any_true" ,nt)
- exprtk_register_function("any_false" ,nf)
- exprtk_register_function("count" , c)
- exprtk_register_function("copy" ,cp)
- exprtk_register_function("rotate_left" ,rl)
- exprtk_register_function("rol" ,rl)
- exprtk_register_function("rotate_right" ,rr)
- exprtk_register_function("ror" ,rr)
- exprtk_register_function("shftl" ,sl)
- exprtk_register_function("shftr" ,sr)
- exprtk_register_function("sort" ,st)
- exprtk_register_function("nth_element" ,ne)
- exprtk_register_function("iota" ,ia)
- exprtk_register_function("sumk" ,sk)
- exprtk_register_function("axpy" ,b1_axpy)
- exprtk_register_function("axpby" ,b1_axpby)
- exprtk_register_function("axpyz" ,b1_axpyz)
- exprtk_register_function("axpbyz",b1_axpbyz)
- exprtk_register_function("axpbz" ,b1_axpbz)
- exprtk_register_function("dot" ,dt)
- exprtk_register_function("dotk" ,dtk)
+ exprtk_register_function("all_true" , at )
+ exprtk_register_function("all_false" , af )
+ exprtk_register_function("any_true" , nt )
+ exprtk_register_function("any_false" , nf )
+ exprtk_register_function("count" , c )
+ exprtk_register_function("copy" , cp )
+ exprtk_register_function("rotate_left" , rl )
+ exprtk_register_function("rol" , rl )
+ exprtk_register_function("rotate_right" , rr )
+ exprtk_register_function("ror" , rr )
+ exprtk_register_function("shftl" , sl )
+ exprtk_register_function("shftr" , sr )
+ exprtk_register_function("sort" , st )
+ exprtk_register_function("nth_element" , ne )
+ exprtk_register_function("iota" , ia )
+ exprtk_register_function("sumk" , sk )
+ exprtk_register_function("axpy" , b1_axpy )
+ exprtk_register_function("axpby" , b1_axpby )
+ exprtk_register_function("axpyz" , b1_axpyz )
+ exprtk_register_function("axpbyz" , b1_axpbyz)
+ exprtk_register_function("axpbz" , b1_axpbz )
+ exprtk_register_function("dot" , dt )
+ exprtk_register_function("dotk" , dtk )
#undef exprtk_register_function
return true;
@@ -40025,11 +40682,11 @@
namespace information
{
static const char* library = "Mathematical Expression Toolkit";
- static const char* version = "2.71828182845904523536028747135"
- "2662497757247093699959574966967"
- "6277240766303535475945713821785"
- "2516642742746639193200305992181";
- static const char* date = "20200101";
+ static const char* version = "2.718281828459045235360287471352"
+ "66249775724709369995957496696762"
+ "77240766303535475945713821785251"
+ "66427427466391932003059921817413";
+ static const char* date = "20210101";
static inline std::string data()
{
@@ -40057,6 +40714,18 @@
#undef exprtk_disable_fallthrough_end
#endif
+ #ifdef exprtk_override
+ #undef exprtk_override
+ #endif
+
+ #ifdef exprtk_final
+ #undef exprtk_final
+ #endif
+
+ #ifdef exprtk_delete
+ #undef exprtk_delete
+ #endif
+
} // namespace exprtk
#endif
diff --git a/exprtk_benchmark.cpp b/exprtk_benchmark.cpp
index 8e9c5fa..637def5 100644
--- a/exprtk_benchmark.cpp
+++ b/exprtk_benchmark.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* ExprTk vs Native Benchmarks *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -150,7 +150,7 @@
bool run_parse_benchmark(exprtk::symbol_table<T>& symbol_table)
{
static const std::size_t rounds = 100000;
- exprtk::parser<double> parser;
+ exprtk::parser<double> parser;
exprtk::expression<double> expression;
expression.register_symbol_table(symbol_table);
@@ -288,7 +288,7 @@
}
};
-void pgo_primer();
+double pgo_primer();
void perform_file_based_benchmark(const std::string& file_name, const std::size_t& rounds = 100000);
int main(int argc, char* argv[])
@@ -359,7 +359,7 @@
return 0;
}
-void pgo_primer()
+double pgo_primer()
{
exprtk::pgo_primer<double>();
@@ -394,6 +394,8 @@
total += native<double>::func16(x,y);
}
}
+
+ return total;
}
std::size_t load_expression_file(const std::string& file_name, std::deque<std::string>& expression_list)
@@ -431,8 +433,8 @@
}
typedef exprtk::symbol_table<double> symbol_table_t;
- typedef exprtk::expression<double> expression_t;
- typedef exprtk::parser<double> parser_t;
+ typedef exprtk::expression<double> expression_t;
+ typedef exprtk::parser<double> parser_t;
std::deque<expression_t> expression_list;
diff --git a/exprtk_functional_test.txt b/exprtk_functional_test.txt
index ee6dfe1..9d9f8e9 100644
--- a/exprtk_functional_test.txt
+++ b/exprtk_functional_test.txt
@@ -8093,4 +8093,214 @@
equal(~{var xx[10^5] := [-3]; var yy[10^5] := [-4]; xx := abs((xx + 1) + (yy + 1)) * 2; sum(xx) == 10^6},true)
equal(~{var xx[10^5] := [-3]; var yy[10^5] := [-4]; xx := abs((1 + xx) + (1 + yy)) * 2; sum(xx) == 10^6},true)
equal(~{var xx[10^5] := [-3]; var yy[10^5] := [-4]; xx := abs((xx + 1) + (1 + yy)) * 2; sum(xx) == 10^6},true)
-equal(~{var xx[10^5] := [-3]; var yy[10^5] := [-4]; xx := abs((1 + xx) + (yy + 1)) * 2; sum(xx) == 10^6},true)
\ No newline at end of file
+equal(~{var xx[10^5] := [-3]; var yy[10^5] := [-4]; xx := abs((1 + xx) + (yy + 1)) * 2; sum(xx) == 10^6},true)
+equal('abcd' like 'abcd*' ,true )
+equal('abcd' like 'abc*' ,true )
+equal('abcd' like 'ab*' ,true )
+equal('abcd' like 'a*' ,true )
+equal('abcd' like 'abc?' ,true )
+equal('a' like 'a*' ,true )
+equal('ab' like 'a*' ,true )
+equal('abcd' like 'abcd*' ,true )
+equal('' like '' ,true )
+equal('abcd' like 'abcd' ,true )
+equal('abcd' like 'abc*' ,true )
+equal('abcd' like '*bcd' ,true )
+equal('abcd' like 'abc?' ,true )
+equal('abcd' like '?bcd' ,true )
+equal('abcd' like 'ab?d' ,true )
+equal('abcd' like 'ab*d' ,true )
+equal('abcd' like 'a?cd' ,true )
+equal('abcd' like 'a*cd' ,true )
+equal('abcd' like 'a??d' ,true )
+equal('abcd' like 'a*?d' ,true )
+equal('abcd' like '*bc*' ,true )
+equal('abcd' like '?bc?' ,true )
+equal('abcd' like '????' ,true )
+equal('abcd' like 'a???' ,true )
+equal('abcd' like 'ab??' ,true )
+equal('abcd' like 'abc?' ,true )
+equal('abcd' like '???d' ,true )
+equal('abcd' like '??cd' ,true )
+equal('abcd' like '?bcd' ,true )
+equal('abcd' like '?b?d' ,true )
+equal('abcd' like 'a?c?' ,true )
+equal('abcd' like 'a??d' ,true )
+equal('abcd' like '?bc?' ,true )
+equal('abcd' like 'ab**' ,true )
+equal('abcd' like 'ab*?' ,true )
+equal('abcd' like 'a***' ,true )
+equal('abcd' like '**cd' ,true )
+equal('abcd' like '*?cd' ,true )
+equal('abcd' like '***d' ,true )
+equal('abcd' like '?*?d' ,true )
+equal('abcd' like '?*?d' ,true )
+equal('abcd' like '*bc*' ,true )
+equal('abcd' like '*bc?' ,true )
+equal('abcd' like '*b??' ,true )
+equal('abcd' like '?bc*' ,true )
+equal('abcd' like '??c*' ,true )
+equal('abcd' like '*b?*' ,true )
+equal('abcd' like '*b*d' ,true )
+equal('abcd' like 'a*c*' ,true )
+equal('abcd' like '?*cd' ,true )
+equal('abcd' like 'ab?*' ,true )
+equal('abcd' like 'ab*?' ,true )
+equal('abcd' like 'a?*d' ,true )
+equal('ab' like 'a*' ,true )
+equal('ab' like 'a?' ,true )
+equal('a' like 'a*' ,true )
+equal('xalabcd' like '*abcd*' ,true )
+equal('xablabcd' like '*abcd*' ,true )
+equal('xabclabcd' like '*abcd*' ,true )
+equal('aaaaa' like '*aa?' ,true )
+equal('abcd' ilike 'abcd*' ,true )
+equal('abcd' ilike 'abc*' ,true )
+equal('abcd' ilike 'ab*' ,true )
+equal('abcd' ilike 'a*' ,true )
+equal('abcd' ilike 'abc?' ,true )
+equal('a' ilike 'a*' ,true )
+equal('ab' ilike 'a*' ,true )
+equal('abcd' ilike 'abcd*' ,true )
+equal('' ilike '' ,true )
+equal('abcd' ilike 'abcd' ,true )
+equal('abcd' ilike 'abc*' ,true )
+equal('abcd' ilike '*bcd' ,true )
+equal('abcd' ilike 'abc?' ,true )
+equal('abcd' ilike '?bcd' ,true )
+equal('abcd' ilike 'ab?d' ,true )
+equal('abcd' ilike 'ab*d' ,true )
+equal('abcd' ilike 'a?cd' ,true )
+equal('abcd' ilike 'a*cd' ,true )
+equal('abcd' ilike 'a??d' ,true )
+equal('abcd' ilike 'a*?d' ,true )
+equal('abcd' ilike '*bc*' ,true )
+equal('abcd' ilike '?bc?' ,true )
+equal('abcd' ilike '????' ,true )
+equal('abcd' ilike 'a???' ,true )
+equal('abcd' ilike 'ab??' ,true )
+equal('abcd' ilike 'abc?' ,true )
+equal('abcd' ilike '???d' ,true )
+equal('abcd' ilike '??cd' ,true )
+equal('abcd' ilike '?bcd' ,true )
+equal('abcd' ilike '?b?d' ,true )
+equal('abcd' ilike 'a?c?' ,true )
+equal('abcd' ilike 'a??d' ,true )
+equal('abcd' ilike '?bc?' ,true )
+equal('abcd' ilike 'ab**' ,true )
+equal('abcd' ilike 'ab*?' ,true )
+equal('abcd' ilike 'a***' ,true )
+equal('abcd' ilike '**cd' ,true )
+equal('abcd' ilike '*?cd' ,true )
+equal('abcd' ilike '***d' ,true )
+equal('abcd' ilike '?*?d' ,true )
+equal('abcd' ilike '?*?d' ,true )
+equal('abcd' ilike '*bc*' ,true )
+equal('abcd' ilike '*bc?' ,true )
+equal('abcd' ilike '*b??' ,true )
+equal('abcd' ilike '?bc*' ,true )
+equal('abcd' ilike '??c*' ,true )
+equal('abcd' ilike '*b?*' ,true )
+equal('abcd' ilike '*b*d' ,true )
+equal('abcd' ilike 'a*c*' ,true )
+equal('abcd' ilike '?*cd' ,true )
+equal('abcd' ilike 'ab?*' ,true )
+equal('abcd' ilike 'ab*?' ,true )
+equal('abcd' ilike 'a?*d' ,true )
+equal('ab' ilike 'a*' ,true )
+equal('ab' ilike 'a?' ,true )
+equal('a' ilike 'a*' ,true )
+equal('xalabcd' ilike '*abcd*',true )
+equal('xablabcd' ilike '*abcd*',true )
+equal('xabclabcd' ilike '*abcd*',true )
+equal('aaaaa' ilike '*aa?' ,true )
+equal('abcd' like 'abcd?' ,false)
+equal('abcd' like 'abc??' ,false)
+equal('abcd' like 'ab???' ,false)
+equal('abcd' like 'a????' ,false)
+equal('abcd' like '?????' ,false)
+equal('a' like 'a?' ,false)
+equal('abcd' like 'xyzw' ,false)
+equal('abcd' like 'xyz' ,false)
+equal('abc' like 'xyzw' ,false)
+equal('abcd' like 'ab?' ,false)
+equal('abcd' like 'a?' ,false)
+equal('abcd' ilike 'abcd?' ,false)
+equal('abcd' ilike 'abc??' ,false)
+equal('abcd' ilike 'ab???' ,false)
+equal('abcd' ilike 'a????' ,false)
+equal('abcd' ilike '?????' ,false)
+equal('a' ilike 'a?' ,false)
+equal('abcd' ilike 'xyzw' ,false)
+equal('abcd' ilike 'xyz' ,false)
+equal('abc' ilike 'xyzw' ,false)
+equal('abcd' ilike 'ab?' ,false)
+equal('abcd' ilike 'a?' ,false)
+equal(true, ~{var s := ~{var n := 1; var m := 2; if (n < m) 'n < m'; else 'n >= m'; }; (s == 'n < m')})
+equal(true, ~{var s := ~{var n := 1; var m := 2; if (n > m) 'n <= m'; else 'n > m'; }; (s == 'n > m')})
+equal(true, ~{var s := ~{var n := 1; var m := 2; if (n < m) 'n < m'; else 'n >' + '= m'; }; (s == 'n < m')})
+equal(true, ~{var s := ~{var n := 1; var m := 2; if (n < m) 'n ' + '< m'; else 'n >= m'; }; (s == 'n < m')})
+equal(true, ~{var s := ~{var n := 1; var m := 2; if (n > m) 'n <= m'; else 'n ' + '> m'; }; (s == 'n > m')})
+equal(true, ~{var s := ~{var n := 1; var m := 2; if (n > m) 'n <' + '= m'; else 'n > m'; }; (s == 'n > m')})
+equal(true, ~{var s := ~{var n := 1; var m := 2; var r0 := 'n < m'; var r1 := 'n >= m'; if (n < m) r0; else r1; }; (s == 'n < m')})
+equal(true, ~{var s := ~{var n := 1; var m := 2; var r0 := 'n < m'; var r1 := 'n >= m'; if (n < m) r0 + ''; else r1 + ''; }; (s == 'n < m')})
+equal(true, ~{var s := ~{var n := 1; var m := 2; var r0 := 'n < m'; var r1 := 'n >= m'; if (n < m) '' + r0; else '' + r1; }; (s == 'n < m')})
+equal(111,~{var n:=1; switch { case n > 0: 111; default: 222; }})
+equal(222,~{var n:=0; switch { case n > 0: 111; default: 222; }})
+equal(111,~{var n:=0; switch { case true : 111; default: 222; }})
+equal(222,~{var n:=0; switch { case false: 111; default: 222; }})
+equal(111,~{var n:=1; switch { default: 222; case n > 0: 111; }})
+equal(222,~{var n:=0; switch { default: 222; case n > 0: 111; }})
+equal(111,~{var n:=0; switch { default: 222; case true : 111; }})
+equal(222,~{var n:=0; switch { default: 222; case false: 111; }})
+equal(111,~{var n:=1; switch { case n == 1: 111; case n == 2: 222; default: 333; }})
+equal(111,~{var n:=1; switch { case n == 1: 111; default: 333; case n == 2: 222; }})
+equal(111,~{var n:=1; switch { default: 333; case n == 1: 111; case n == 2: 222; }})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; if (1 < 2, v0, v1) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; if (1 > 2, v0, v1) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; if (1 < 2, v0 - v1, v1 - v0) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; if (1 > 2, v0 - v1, v1 - v0) == (v1 - v0)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; if (x_ < y_, v0, v1) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; if (x_ > y_, v0, v1) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; if (x_ < y_, v0 - v1, v1 - v0) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; if (x_ > y_, v0 - v1, v1 - v0) == (v1 - v0)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; if (1 < 2, v0, v1) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; if (1 > 2, v0, v1) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; if (1 < 2, v0 - v1, v1 - v0) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; if (1 > 2, v0 - v1, v1 - v0) == (v1 - v0)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; if (x_ < y_, v0, v1) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; if (x_ > y_, v0, v1) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; if (x_ < y_, v0 - v1, v1 - v0) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; if (x_ > y_, v0 - v1, v1 - v0) == (v1 - v0)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; (if (1 < 2) v0; else v1;) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; (if (1 > 2) v0; else v1;) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; (if (1 < 2) v0 - v1; else v1 - v0;) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; (if (1 > 2) v0 - v1; else v1 - v0;) == (v1 - v0)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; (if (x_ < y_) v0; else v1;) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; (if (x_ > y_) v0; else v1;) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; (if (x_ < y_) v0 - v1; else v1 - v0;) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; (if (x_ > y_) v0 - v1; else v1 - v0;) == (v1 - v0)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; (if (1 < 2) v0; else v1;) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; (if (1 > 2) v0; else v1;) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; (if (1 < 2) v0 - v1; else v1 - v0;) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; (if (1 > 2) v0 - v1; else v1 - v0;) == (v1 - v0)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; (if (x_ < y_) v0; else v1;) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; (if (x_ > y_) v0; else v1;) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; (if (x_ < y_) v0 - v1; else v1 - v0;) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; (if (x_ > y_) v0 - v1; else v1 - v0;) == (v1 - v0)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; ((1 < 2) ? v0 : v1) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; ((1 > 2) ? v0 : v1) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; ((1 < 2) ? v0 - v1 : v1 - v0) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; ((1 > 2) ? v0 - v1 : v1 - v0) == (v1 - v0)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; ((x_ < y_) ? v0 : v1) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; ((x_ > y_) ? v0 : v1) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; ((x_ < y_) ? v0 - v1 : v1 - v0) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x_ := 1; var y_ := 2; ((x_ > y_) ? v0 - v1 : v1 - v0) == (v1 - v0)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; ((1 < 2) ? v0 : v1) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; ((1 > 2) ? v0 : v1) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; ((1 < 2) ? v0 - v1 : v1 - v0) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; ((1 > 2) ? v0 - v1 : v1 - v0) == (v1 - v0)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; ((x_ < y_) ? v0 : v1) == v0})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; ((x_ > y_) ? v0 : v1) == v1})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; ((x_ < y_) ? v0 - v1 : v1 - v0) == (v0 - v1)})
+equal(true,~{var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x_ := 1; var y_ := 2; ((x_ > y_) ? v0 - v1 : v1 - v0) == (v1 - v0)})
\ No newline at end of file
diff --git a/exprtk_simple_example_01.cpp b/exprtk_simple_example_01.cpp
index 80eafe1..f1fb113 100644
--- a/exprtk_simple_example_01.cpp
+++ b/exprtk_simple_example_01.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 1 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -26,8 +26,8 @@
void trig_function()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string expression_string =
"clamp(-1.0,sin(2 * pi * x) + cos(x / 2 * pi),+1.0)";
diff --git a/exprtk_simple_example_02.cpp b/exprtk_simple_example_02.cpp
index 56b9c9b..ef7f70c 100644
--- a/exprtk_simple_example_02.cpp
+++ b/exprtk_simple_example_02.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 2 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -26,8 +26,8 @@
void square_wave()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string expr_string =
"a*(4/pi)*"
diff --git a/exprtk_simple_example_03.cpp b/exprtk_simple_example_03.cpp
index 8e5a164..0de505e 100644
--- a/exprtk_simple_example_03.cpp
+++ b/exprtk_simple_example_03.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 3 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -26,8 +26,8 @@
void polynomial()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string expression_string =
"25x^5 - 35x^4 - 15x^3 + 40x^2 - 15x + 1";
diff --git a/exprtk_simple_example_04.cpp b/exprtk_simple_example_04.cpp
index aca7014..0b25ec5 100644
--- a/exprtk_simple_example_04.cpp
+++ b/exprtk_simple_example_04.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 4 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -25,11 +25,11 @@
template <typename T>
void fibonacci()
{
- typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
- typedef exprtk::function_compositor<T> compositor_t;
- typedef typename compositor_t::function function_t;
+ typedef exprtk::symbol_table<T> symbol_table_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
+ typedef exprtk::function_compositor<T> compositor_t;
+ typedef typename compositor_t::function function_t;
compositor_t compositor;
diff --git a/exprtk_simple_example_05.cpp b/exprtk_simple_example_05.cpp
index 50d7987..4450fb2 100644
--- a/exprtk_simple_example_05.cpp
+++ b/exprtk_simple_example_05.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 5 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -47,8 +47,8 @@
void custom_function()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string expression_string =
"myfunc(sin(x / pi), otherfunc(3 * y, x / 2, x * y))";
diff --git a/exprtk_simple_example_06.cpp b/exprtk_simple_example_06.cpp
index 0af6f8b..2475905 100644
--- a/exprtk_simple_example_06.cpp
+++ b/exprtk_simple_example_06.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 6 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -26,8 +26,8 @@
void vector_function()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string expression_string =
" for (var i := 0; i < min(x[],y[],z[]); i += 1) "
diff --git a/exprtk_simple_example_07.cpp b/exprtk_simple_example_07.cpp
index bdf3c3b..ac7d7e2 100644
--- a/exprtk_simple_example_07.cpp
+++ b/exprtk_simple_example_07.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 7 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -26,8 +26,8 @@
void logic()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string expression_string = "not(A and B) or C";
diff --git a/exprtk_simple_example_08.cpp b/exprtk_simple_example_08.cpp
index 4565098..f2b76c7 100644
--- a/exprtk_simple_example_08.cpp
+++ b/exprtk_simple_example_08.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 8 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -25,12 +25,12 @@
template <typename T>
void composite()
{
- typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
- typedef exprtk::parser_error::type err_t;
- typedef exprtk::function_compositor<T> compositor_t;
- typedef typename compositor_t::function function_t;
+ typedef exprtk::symbol_table<T> symbol_table_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
+ typedef exprtk::parser_error::type error_t;
+ typedef exprtk::function_compositor<T> compositor_t;
+ typedef typename compositor_t::function function_t;
compositor_t compositor;
@@ -65,7 +65,7 @@
for (std::size_t i = 0; i < parser.error_count(); ++i)
{
- const err_t error = parser.get_error(i);
+ const error_t error = parser.get_error(i);
printf("Error: %02d Position: %02d Type: [%14s] Msg: %s\tExpression: %s\n",
static_cast<unsigned int>(i),
diff --git a/exprtk_simple_example_09.cpp b/exprtk_simple_example_09.cpp
index b11f193..3a3892c 100644
--- a/exprtk_simple_example_09.cpp
+++ b/exprtk_simple_example_09.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 9 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -25,11 +25,11 @@
template <typename T>
void primes()
{
- typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
- typedef exprtk::function_compositor<T> compositor_t;
- typedef typename compositor_t::function function_t;
+ typedef exprtk::symbol_table<T> symbol_table_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
+ typedef exprtk::function_compositor<T> compositor_t;
+ typedef typename compositor_t::function function_t;
T x = T(0);
diff --git a/exprtk_simple_example_10.cpp b/exprtk_simple_example_10.cpp
index 13728da..7b11d7b 100644
--- a/exprtk_simple_example_10.cpp
+++ b/exprtk_simple_example_10.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 10 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -26,11 +26,11 @@
template <typename T>
void newton_sqrt()
{
- typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
- typedef exprtk::function_compositor<T> compositor_t;
- typedef typename compositor_t::function function_t;
+ typedef exprtk::symbol_table<T> symbol_table_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
+ typedef exprtk::function_compositor<T> compositor_t;
+ typedef typename compositor_t::function function_t;
T x = T(0);
diff --git a/exprtk_simple_example_11.cpp b/exprtk_simple_example_11.cpp
index 454c8f0..e2ccf35 100644
--- a/exprtk_simple_example_11.cpp
+++ b/exprtk_simple_example_11.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 11 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -26,8 +26,8 @@
void square_wave2()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string wave_program =
" var r := 0; "
diff --git a/exprtk_simple_example_12.cpp b/exprtk_simple_example_12.cpp
index ce398bd..d1adb77 100644
--- a/exprtk_simple_example_12.cpp
+++ b/exprtk_simple_example_12.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 12 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -26,8 +26,8 @@
void bubble_sort()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string bubblesort_program =
" var upper_bound := v[]; "
diff --git a/exprtk_simple_example_13.cpp b/exprtk_simple_example_13.cpp
index e1922e8..32b6976 100644
--- a/exprtk_simple_example_13.cpp
+++ b/exprtk_simple_example_13.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 13 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -28,8 +28,8 @@
void savitzky_golay_filter()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string sgfilter_program =
" var weight[9] := "
@@ -69,15 +69,15 @@
// Generate a signal with noise.
for (T t = T(-5); t <= T(+5); t += T(10.0 / n))
{
- T noise = T(0.5 * (rand() / (RAND_MAX + 1.0) - 0.5));
+ const T noise = T(0.5 * (rand() / (RAND_MAX + 1.0) - 0.5));
v_in.push_back(sin(2.0 * pi * t) + noise);
}
v_out.resize(v_in.size());
symbol_table_t symbol_table;
- symbol_table.add_vector("v_in" , v_in);
- symbol_table.add_vector("v_out",v_out);
+ symbol_table.add_vector("v_in" , v_in );
+ symbol_table.add_vector("v_out", v_out);
expression_t expression;
expression.register_symbol_table(symbol_table);
diff --git a/exprtk_simple_example_14.cpp b/exprtk_simple_example_14.cpp
index bc508a2..5ff9d79 100644
--- a/exprtk_simple_example_14.cpp
+++ b/exprtk_simple_example_14.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 14 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -26,7 +26,7 @@
void stddev_example()
{
typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::parser<T> parser_t;
const std::string stddev_program =
" var x[25] := { "
diff --git a/exprtk_simple_example_15.cpp b/exprtk_simple_example_15.cpp
index f7364fd..852a643 100644
--- a/exprtk_simple_example_15.cpp
+++ b/exprtk_simple_example_15.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 15 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -26,8 +26,8 @@
void black_scholes_merton_model()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string bsm_model_program =
" var d1 := (log(s / x) + (r + v^2 / 2) * t) / (v * sqrt(t)); "
@@ -67,7 +67,7 @@
{
callput_flag = "call";
- T bsm = expression.value();
+ const T bsm = expression.value();
printf("BSM(%s,%5.3f,%5.3f,%5.3f,%5.3f,%5.3f) = %10.6f\n",
callput_flag.c_str(),
@@ -78,7 +78,7 @@
{
callput_flag = "put";
- T bsm = expression.value();
+ const T bsm = expression.value();
printf("BSM(%s,%5.3f,%5.3f,%5.3f,%5.3f,%5.3f) = %10.6f\n",
callput_flag.c_str(),
diff --git a/exprtk_simple_example_16.cpp b/exprtk_simple_example_16.cpp
index cd76f84..06ee39c 100644
--- a/exprtk_simple_example_16.cpp
+++ b/exprtk_simple_example_16.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 16 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -27,8 +27,8 @@
void linear_least_squares()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string linear_least_squares_program =
" if (x[] == y[]) "
@@ -55,11 +55,11 @@
T rmse = T(0);
symbol_table_t symbol_table;
- symbol_table.add_variable("alpha",alpha);
- symbol_table.add_variable("beta" ,beta );
- symbol_table.add_variable("rmse" ,rmse );
- symbol_table.add_vector ("x" ,x );
- symbol_table.add_vector ("y" ,y );
+ symbol_table.add_variable("alpha", alpha);
+ symbol_table.add_variable("beta" , beta );
+ symbol_table.add_variable("rmse" , rmse );
+ symbol_table.add_vector ("x" , x );
+ symbol_table.add_vector ("y" , y );
expression_t expression;
expression.register_symbol_table(symbol_table);
@@ -69,10 +69,10 @@
expression.value();
- printf("alpha: %15.12f\n",alpha);
- printf("beta: %15.12f\n",beta );
- printf("rmse: %15.12f\n",rmse );
- printf("y = %15.12fx + %15.12f\n",beta,alpha);
+ printf("alpha: %15.12f\n", alpha);
+ printf("beta: %15.12f\n", beta );
+ printf("rmse: %15.12f\n", rmse );
+ printf("y = %15.12fx + %15.12f\n", beta, alpha);
}
int main()
diff --git a/exprtk_simple_example_17.cpp b/exprtk_simple_example_17.cpp
index 50263aa..d141204 100644
--- a/exprtk_simple_example_17.cpp
+++ b/exprtk_simple_example_17.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 17 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -44,8 +44,8 @@
void monte_carlo_pi()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string monte_carlo_pi_program =
" var experiments[5 * 10^7] := [(rnd_01^2 + rnd_01^2) <= 1]; "
diff --git a/exprtk_simple_example_18.cpp b/exprtk_simple_example_18.cpp
index 4fabc72..84f4575 100644
--- a/exprtk_simple_example_18.cpp
+++ b/exprtk_simple_example_18.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 18 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -26,8 +26,8 @@
void file_io()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string fileio_program =
" var file_name := 'file.txt'; "
diff --git a/exprtk_simple_example_19.cpp b/exprtk_simple_example_19.cpp
index 5d0fc20..753022f 100644
--- a/exprtk_simple_example_19.cpp
+++ b/exprtk_simple_example_19.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Simple Example 19 *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -81,8 +81,8 @@
void vector_randu()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
const std::string vecrandu_program =
" var noise[6] := [0]; "
@@ -109,9 +109,9 @@
randu<T> randu;
symbol_table_t symbol_table;
- symbol_table.add_vector ("signal" , signal);
- symbol_table.add_function("println",println);
- symbol_table.add_function("randu" , randu);
+ symbol_table.add_vector ("signal" , signal );
+ symbol_table.add_function("println", println);
+ symbol_table.add_function("randu" , randu );
expression_t expression;
expression.register_symbol_table(symbol_table);
diff --git a/exprtk_test.cpp b/exprtk_test.cpp
index 91e7593..9e62b10 100644
--- a/exprtk_test.cpp
+++ b/exprtk_test.cpp
@@ -3,7 +3,7 @@
* C++ Mathematical Expression Toolkit Library *
* *
* Examples and Unit-Tests *
- * Author: Arash Partow (1999-2020) *
+ * Author: Arash Partow (1999-2021) *
* URL: http://www.partow.net/programming/exprtk/index.html *
* *
* Copyright notice: *
@@ -358,6 +358,42 @@
test_t("( 7 - 2 )",+5.0),
test_t("( 8 - 1 )",+7.0),
test_t("( 9 - 0 )",+9.0),
+ test_t("1 - -1" , 2.0),
+ test_t("1 --1" , 2.0),
+ test_t("1-- 1" , 2.0),
+ test_t("1--1" , 2.0),
+ test_t("1 -- -1", 0.0),
+ test_t("1 + -1" , 0.0),
+ test_t("1 +-1" , 0.0),
+ test_t("1+- 1" , 0.0),
+ test_t("1+-1" , 0.0),
+ test_t("1 +- -1", 2.0),
+ test_t("1 + +1" , 2.0),
+ test_t("1 ++1" , 2.0),
+ test_t("1 - -1 + 1" , 3.0),
+ test_t("1 --1 + 1" , 3.0),
+ test_t("1-- 1 + 1" , 3.0),
+ test_t("1--1 + 1" , 3.0),
+ test_t("1 -- -1 + 1", 1.0),
+ test_t("1 + -1 + 1" , 1.0),
+ test_t("1 +-1 + 1" , 1.0),
+ test_t("1+- 1 + 1" , 1.0),
+ test_t("1+-1 + 1" , 1.0),
+ test_t("1 +- -1 + 1", 3.0),
+ test_t("1 + +1 + 1" , 3.0),
+ test_t("1 ++1 + 1" , 3.0),
+ test_t("1 - -1 - 1" , 1.0),
+ test_t("1 --1 - 1" , 1.0),
+ test_t("1-- 1 - 1" , 1.0),
+ test_t("1--1 - 1" , 1.0),
+ test_t("1 -- -1 - 1", -1.0),
+ test_t("1 + -1 - 1" , -1.0),
+ test_t("1 +-1 - 1" , -1.0),
+ test_t("1+- 1 - 1" , -1.0),
+ test_t("1+-1 - 1" , -1.0),
+ test_t("1 +- -1 - 1", 1.0),
+ test_t("1 + +1 - 1" , 1.0),
+ test_t("1 ++1 - 1" , 1.0),
test_t("-(1+2)",-3.0),
test_t("+(1+2)",+3.0),
test_t("+(1-2)",-1.0),
@@ -1162,14 +1198,14 @@
return false;
}
- T result = expression.value();
+ const T result = expression.value();
if (not_equal(result,expected_result))
{
printf("test_expression() - Computation Error: Expression: [%s]\tExpected: %19.15f\tResult: %19.15f\n",
expression_string.c_str(),
- (double)expected_result,
- (double)result);
+ static_cast<double>(expected_result),
+ static_cast<double>(result));
return false;
}
@@ -1178,6 +1214,43 @@
}
template <typename T>
+struct edge_cases {};
+
+template <>
+struct edge_cases<float>
+{
+ static inline std::vector<test_t> test_cases()
+ {
+ std::vector<test_t> cases;
+ cases.push_back(test_t(" 1.175494350822287508e-38", 1.175494350822287508e-38));
+ cases.push_back(test_t(" 3.402823466385288598e+38", 3.402823466385288598e+38));
+ cases.push_back(test_t("+1.175494350822287508e-38", +1.175494350822287508e-38));
+ cases.push_back(test_t("+3.402823466385288598e+38", +3.402823466385288598e+38));
+ cases.push_back(test_t("-1.175494350822287508e-38", -1.175494350822287508e-38));
+ cases.push_back(test_t("-3.402823466385288598e+38", -3.402823466385288598e+38));
+
+ return cases;
+ }
+};
+
+template <>
+struct edge_cases<double>
+{
+ static inline std::vector<test_t> test_cases()
+ {
+ std::vector<test_t> cases;
+ cases.push_back(test_t(" 2.2250738585072013831e-308", 2.2250738585072013831e-308));
+ cases.push_back(test_t(" 1.7976931348623157081e+308", 1.7976931348623157081e+308));
+ cases.push_back(test_t("+2.2250738585072013831e-308", +2.2250738585072013831e-308));
+ cases.push_back(test_t("+1.7976931348623157081e+308", +1.7976931348623157081e+308));
+ cases.push_back(test_t("-2.2250738585072013831e-308", -2.2250738585072013831e-308));
+ cases.push_back(test_t("-1.7976931348623157081e+308", -1.7976931348623157081e+308));
+
+ return cases;
+ }
+};
+
+template <typename T>
inline bool run_test00()
{
const std::size_t rounds = 10;
@@ -1198,6 +1271,25 @@
}
}
+ {
+ const std::vector<test_t> tests = edge_cases<T>::test_cases();
+
+ bool result = true;
+
+ for (std::size_t i = 0; i < tests.size(); ++i)
+ {
+ if (!test_expression<T>(tests[i].first,T(tests[i].second)))
+ {
+ result = false;
+ }
+ }
+
+ if (!result)
+ {
+ return false;
+ }
+ }
+
return true;
}
@@ -1256,34 +1348,106 @@
test_xy<T>("2 * (x + y) - 1" ,T(2.2),T(3.3),T(10.0 )),
test_xy<T>("y + (x + 1)" ,T(2.2),T(3.3),T(6.5 )),
test_xy<T>("(x + 1) + y" ,T(2.2),T(3.3),T(6.5 )),
- test_xy<T>("2 * x" ,T(2.2),T(0.0),T(4.4)),
- test_xy<T>("x * 2" ,T(2.2),T(0.0),T(4.4)),
- test_xy<T>("1.1 + x",T(2.2),T(0.0),T(3.3)),
- test_xy<T>("x + 1.1",T(2.2),T(0.0),T(3.3)),
- test_xy<T>("x * 1 == x" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("1 * x == x" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("y * 1 == y" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("1 * y == y" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("x * 0 == 0" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("0 * x == 0" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("y * 0 == 0" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("0 * y == 0" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("x + 1 == 1 + x",T(2.0),T(3.0),T(1.0)),
- test_xy<T>("y + 1 == 1 + y",T(2.0),T(3.0),T(1.0)),
- test_xy<T>("x + y == y + x",T(2.0),T(3.0),T(1.0)),
- test_xy<T>("x * y == y * x",T(2.0),T(3.0),T(1.0)),
- test_xy<T>("x < y" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("y > x" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("x <= y" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("y >= x" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("x + y > y" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("x + y > x" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("x * y > y" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("x * y > x" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("(x + y) > y" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("(x + y) > x" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("(x * y) > y" ,T(2.0),T(3.0),T(1.0)),
- test_xy<T>("(x * y) > x" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("2 * x" ,T(2.2),T(0.0),T(4.4)),
+ test_xy<T>("x * 2" ,T(2.2),T(0.0),T(4.4)),
+ test_xy<T>("1.1 + x" ,T(2.2),T(0.0),T(3.3)),
+ test_xy<T>("x + 1.1" ,T(2.2),T(0.0),T(3.3)),
+ test_xy<T>("x - -1 " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("x --1 " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("x-- 1 " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("x--1 " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("x -- -1" ,T(1.0),T(0.0),T(0)),
+ test_xy<T>("x + -1 " ,T(1.0),T(0.0),T(0)),
+ test_xy<T>("x +-1 " ,T(1.0),T(0.0),T(0)),
+ test_xy<T>("x+- 1 " ,T(1.0),T(0.0),T(0)),
+ test_xy<T>("x+-1 " ,T(1.0),T(0.0),T(0)),
+ test_xy<T>("x +- -1" ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("x + +1 " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("x ++1 " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("1 - -x " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("1 --x " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("1-- x " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("1--x " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("1 -- -x" ,T(1.0),T(0.0),T(0)),
+ test_xy<T>("1 + -x " ,T(1.0),T(0.0),T(0)),
+ test_xy<T>("1 +-x " ,T(1.0),T(0.0),T(0)),
+ test_xy<T>("1+- x " ,T(1.0),T(0.0),T(0)),
+ test_xy<T>("1+-x " ,T(1.0),T(0.0),T(0)),
+ test_xy<T>("1 +- -x" ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("1 + +x " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("1 ++x " ,T(1.0),T(0.0),T(2)),
+ test_xy<T>("(x - -1 + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(x --1 + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(x-- 1 + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(x--1 + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(x -- -1 + 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(x + -1 + 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(x +-1 + 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(x+- 1 + 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(x+-1 + 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(x +- -1 + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(x + +1 + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(x ++1 + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(1 - -x + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(1 --x + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(1-- x + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(1--x + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(1 -- -x + 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1 + -x + 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1 +-x + 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1+- x + 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1+-x + 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1 +- -x + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(1 + +x + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(1 ++x + 1)" ,T(1.0),T(0.0),T(3)),
+ test_xy<T>("(x - -1 - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(x --1 - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(x-- 1 - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(x--1 - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(x -- -1 - 1)" ,T(1.0),T(0.0),T(-1)),
+ test_xy<T>("(x + -1 - 1)" ,T(1.0),T(0.0),T(-1)),
+ test_xy<T>("(x +-1 - 1)" ,T(1.0),T(0.0),T(-1)),
+ test_xy<T>("(x+- 1 - 1)" ,T(1.0),T(0.0),T(-1)),
+ test_xy<T>("(x+-1 - 1)" ,T(1.0),T(0.0),T(-1)),
+ test_xy<T>("(x +- -1 - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(x + +1 - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(x ++1 - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1 - -x - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1 --x - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1-- x - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1--x - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1 -- -x - 1)" ,T(1.0),T(0.0),T(-1)),
+ test_xy<T>("(1 + -x - 1)" ,T(1.0),T(0.0),T(-1)),
+ test_xy<T>("(1 +-x - 1)" ,T(1.0),T(0.0),T(-1)),
+ test_xy<T>("(1+- x - 1)" ,T(1.0),T(0.0),T(-1)),
+ test_xy<T>("(1+-x - 1)" ,T(1.0),T(0.0),T(-1)),
+ test_xy<T>("(1 +- -x - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1 + +x - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("(1 ++x - 1)" ,T(1.0),T(0.0),T(1)),
+ test_xy<T>("x * 1 == x" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("1 * x == x" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("y * 1 == y" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("1 * y == y" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("x * 0 == 0" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("0 * x == 0" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("y * 0 == 0" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("0 * y == 0" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("x + 1 == 1 + x" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("y + 1 == 1 + y" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("x + y == y + x" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("x * y == y * x" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("x < y" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("y > x" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("x <= y" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("y >= x" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("x + y > y" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("x + y > x" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("x * y > y" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("x * y > x" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("(x + y) > y" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("(x + y) > x" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("(x * y) > y" ,T(2.0),T(3.0),T(1.0)),
+ test_xy<T>("(x * y) > x" ,T(2.0),T(3.0),T(1.0)),
test_xy<T>("(2x + 3y) == (2*x + 3*y)" ,T(2.0),T(3.0),T(1.0)),
test_xy<T>("2(x + y) == (2*x + 2*y)" ,T(2.0),T(3.0),T(1.0)),
test_xy<T>(" (x + y)3 == (3*x + 3*y)" ,T(2.0),T(3.0),T(1.0)),
@@ -1646,14 +1810,14 @@
}
}
- T result = expression.value();
+ const T result = expression.value();
if (not_equal(result,test.result))
{
printf("run_test01() - Computation Error: Expression: [%s]\tExpected: %19.15f\tResult: %19.15f\n",
test.expr.c_str(),
- (double)test.result,
- (double)result);
+ static_cast<double>(test.result),
+ static_cast<double>(result));
loop_result = false;
}
@@ -1758,14 +1922,14 @@
}
}
- T result = expression.value();
+ const T result = expression.value();
if (not_equal(result,test.result))
{
printf("run_test01() - Computation Error: Expression: [%s]\tExpected: %19.15f\tResult: %19.15f\n",
test.expr.c_str(),
- (double)test.result,
- (double)result);
+ static_cast<double>(test.result),
+ static_cast<double>(result));
loop_result = false;
}
@@ -1841,14 +2005,14 @@
}
}
- T result = expression.value();
+ const T result = expression.value();
if (not_equal(result,T(1)))
{
printf("run_test01() - Computation Error: Expression: [%s]\tExpected: %19.15f\tResult: %19.15f\n",
expr_list[i].c_str(),
- (double)1.0,
- (double)result);
+ static_cast<double>(1.0),
+ static_cast<double>(result));
loop_result = false;
}
@@ -1901,14 +2065,14 @@
}
}
- T result = expression.value();
+ const T result = expression.value();
if (not_equal(result,T(1)))
{
printf("run_test01() - Computation Error: Expression: [%s]\tExpected: %19.15f\tResult: %19.15f\n",
expr_list[i].c_str(),
- (double)1.0,
- (double)result);
+ static_cast<double>(1.0),
+ static_cast<double>(result));
loop_result = false;
}
}
@@ -2422,6 +2586,17 @@
test_ab<T>("var i := 0; a[0:i+3] <=> b[:]; (a == '0123X') and (b == 'XXXX4567890')", "XXXXX","01234567890",T(1.0)),
test_ab<T>("var i := 0; a[0:i+4] <=> b[:]; (a == '01234') and (b == 'XXXXX567890')", "XXXXX","01234567890",T(1.0)),
+ test_ab<T>("var y:= 2; '01234567890'[y:] == a ", "234567890","" ,T(1.0)),
+ test_ab<T>("var y:= 2; '01234567890'[y:][y:] == a ", "4567890" ,"" ,T(1.0)),
+ test_ab<T>("var y:= 2; '01234567890'[y:][y:][y:] == a ", "67890" ,"" ,T(1.0)),
+ test_ab<T>("var y:= 2; '01234567890'[y:][y:][y:][y:] == a ", "890" ,"" ,T(1.0)),
+ test_ab<T>("var y:= 2; '01234567890'[y:][y:][y:][y:][y:] == a", "0" ,"" ,T(1.0)),
+ test_ab<T>("var y:= 2; '0123456789'[y:] == a ", "23456789" ,"" ,T(1.0)),
+ test_ab<T>("var y:= 2; '0123456789'[y:][y:] == a ", "456789" ,"" ,T(1.0)),
+ test_ab<T>("var y:= 2; '0123456789'[y:][y:][y:] == a ", "6789" ,"" ,T(1.0)),
+ test_ab<T>("var y:= 2; '0123456789'[y:][y:][y:][y:] == a ", "89" ,"" ,T(1.0)),
+ test_ab<T>("var y:= 2; '0123456789'[y:][y:][y:][y:][y:] == a ", "" ,"" ,T(1.0)),
+
test_ab<T>("var x := 'XXXXX'; var y := '01234567890'; x[0:0] := y[:]; x == '0XXXX'", "","",T(1.0)),
test_ab<T>("var x := 'XXXXX'; var y := '01234567890'; x[0:1] := y[:]; x == '01XXX'", "","",T(1.0)),
test_ab<T>("var x := 'XXXXX'; var y := '01234567890'; x[0:2] := y[:]; x == '012XX'", "","",T(1.0)),
@@ -2598,8 +2773,8 @@
printf("run_test02() - Computation Error: Expression: [%s]\tExpected: %19.15f\tResult: %19.15f\t"
"a='%s'\tb='%s'\tc='%s'\n",
test.expr.c_str(),
- (double)test.result,
- (double)expr_result,
+ static_cast<double>(test.result),
+ static_cast<double>(expr_result),
str_a.c_str(),
str_b.c_str(),
str_c.c_str());
@@ -2676,8 +2851,8 @@
inline bool run_test03()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
std::string expression_string = "A+A0+aA+Aa0+b+B1+Bb+bB1+A+A0+AA+AA0+B+B1+BB+BB1+a+a0+aa+aa0+b+b1+bb+bb1+"
"c+C2+Cc+Cc2+D+D3+dD+dD3+C+C2+CC+CC2+D+D3+DD+DD3+c+c2+cc+cc2+d+d3+dd+dd3+"
@@ -3013,10 +3188,10 @@
{
printf("run_test04() - Computation Error: Expression: [%s]\tExpected: %19.15f\tResult: %19.15f x:%19.15f\ty:%19.15f\n",
expression_string.c_str(),
- (double)result1,
- (double)result2,
- (double)x,
- (double)y);
+ static_cast<double>(result1),
+ static_cast<double>(result2),
+ static_cast<double>(x),
+ static_cast<double>(y));
return false;
}
@@ -3083,10 +3258,10 @@
{
printf("run_test05() - Computation Error: Expression: [%s]\tExpected: %19.15f\tResult: %19.15f x:%19.15f\ty:%19.15f\tIndex:%d\n",
expression_string.c_str(),
- (double)real_result,
- (double)result,
- (double)x,
- (double)y,
+ static_cast<double>(real_result),
+ static_cast<double>(result),
+ static_cast<double>(x),
+ static_cast<double>(y),
static_cast<unsigned int>(i));
return false;
@@ -3140,8 +3315,8 @@
if (not_equal(total_area1,T(pi) / T(2),T(0.000001)))
{
printf("run_test06() - Integration Error: Expected: %19.15f\tResult: %19.15f\n",
- (double)(pi / T(2)),
- (double)total_area1);
+ static_cast<double>(pi / T(2)),
+ static_cast<double>(total_area1));
return false;
}
@@ -3192,9 +3367,9 @@
if (not_equal(deriv1_result1,deriv1_real_result,T(0.00001)))
{
printf("run_test07() - 1st Derivative Error: x: %19.15f\tExpected: %19.15f\tResult: %19.15f\n",
- (double)x,
- (double)deriv1_real_result,
- (double)deriv1_result1);
+ static_cast<double>(x),
+ static_cast<double>(deriv1_real_result),
+ static_cast<double>(deriv1_result1));
return false;
}
@@ -3214,9 +3389,9 @@
if (not_equal(deriv2_result1,deriv2_real_result,T(0.01)))
{
printf("run_test07() - 2nd Derivative Error: x: %19.15f\tExpected: %19.15f\tResult: %19.15f\n",
- (double)x,
- (double)deriv2_real_result,
- (double)deriv2_result1);
+ static_cast<double>(x),
+ static_cast<double>(deriv2_real_result),
+ static_cast<double>(deriv2_result1));
return false;
}
@@ -3236,9 +3411,9 @@
if (not_equal(deriv3_result1,deriv3_real_result,T(0.01)))
{
printf("run_test07() - 3rd Derivative Error: x: %19.15f\tExpected: %19.15f\tResult: %19.15f\n",
- (double)x,
- (double)deriv3_real_result,
- (double)deriv3_result1);
+ static_cast<double>(x),
+ static_cast<double>(deriv3_real_result),
+ static_cast<double>(deriv3_result1));
return false;
}
@@ -3526,9 +3701,9 @@
const T pi = T(3.141592653589793238462643383279502);
- T result = expression.value();
+ const T result = expression.value();
- T expected = T(4) *
+ const T expected = T(4) *
(
mf(sin(x*pi),y / T(2)) +
mf(sin(x*pi),y / T(2)) +
@@ -3545,8 +3720,8 @@
if (not_equal(result,expected,T(0.0000001)))
{
printf("run_test09() - Error Expected: %19.15f\tResult: %19.15f\n",
- (double)expected,
- (double)result);
+ static_cast<double>(expected),
+ static_cast<double>(result));
return false;
}
@@ -4311,6 +4486,78 @@
{
"var x; 1",
"var x := 1; x",
+ "var x:= 1; x - -1 == 2",
+ "var x:= 1; x --1 == 2",
+ "var x:= 1; x-- 1 == 2",
+ "var x:= 1; x--1 == 2",
+ "var x:= 1; x -- -1== 0",
+ "var x:= 1; x + -1 == 0",
+ "var x:= 1; x +-1 == 0",
+ "var x:= 1; x+- 1 == 0",
+ "var x:= 1; x+-1 == 0",
+ "var x:= 1; x +- -1== 2",
+ "var x:= 1; x + +1 == 2",
+ "var x:= 1; x ++1 == 2",
+ "var x:= 1; 1 - -x == 2",
+ "var x:= 1; 1 --x == 2",
+ "var x:= 1; 1-- x == 2",
+ "var x:= 1; 1--x == 2",
+ "var x:= 1; 1 -- -x== 0",
+ "var x:= 1; 1 + -x == 0",
+ "var x:= 1; 1 +-x == 0",
+ "var x:= 1; 1+- x == 0",
+ "var x:= 1; 1+-x == 0",
+ "var x:= 1; 1 +- -x== 2",
+ "var x:= 1; 1 + +x == 2",
+ "var x:= 1; 1 ++x == 2",
+ "var x:= 1; (x - -1 + 1) == 3",
+ "var x:= 1; (x --1 + 1) == 3",
+ "var x:= 1; (x-- 1 + 1) == 3",
+ "var x:= 1; (x--1 + 1) == 3",
+ "var x:= 1; (x -- -1 + 1) == 1",
+ "var x:= 1; (x + -1 + 1) == 1",
+ "var x:= 1; (x +-1 + 1) == 1",
+ "var x:= 1; (x+- 1 + 1) == 1",
+ "var x:= 1; (x+-1 + 1) == 1",
+ "var x:= 1; (x +- -1 + 1) == 3",
+ "var x:= 1; (x + +1 + 1) == 3",
+ "var x:= 1; (x ++1 + 1) == 3",
+ "var x:= 1; (1 - -x + 1) == 3",
+ "var x:= 1; (1 --x + 1) == 3",
+ "var x:= 1; (1-- x + 1) == 3",
+ "var x:= 1; (1--x + 1) == 3",
+ "var x:= 1; (1 -- -x + 1) == 1",
+ "var x:= 1; (1 + -x + 1) == 1",
+ "var x:= 1; (1 +-x + 1) == 1",
+ "var x:= 1; (1+- x + 1) == 1",
+ "var x:= 1; (1+-x + 1) == 1",
+ "var x:= 1; (1 +- -x + 1) == 3",
+ "var x:= 1; (1 + +x + 1) == 3",
+ "var x:= 1; (1 ++x + 1) == 3",
+ "var x:= 1; (x - -1 - 1) == 1",
+ "var x:= 1; (x --1 - 1) == 1",
+ "var x:= 1; (x-- 1 - 1) == 1",
+ "var x:= 1; (x--1 - 1) == 1",
+ "var x:= 1; (x -- -1 - 1) == -1",
+ "var x:= 1; (x + -1 - 1) == -1",
+ "var x:= 1; (x +-1 - 1) == -1",
+ "var x:= 1; (x+- 1 - 1) == -1",
+ "var x:= 1; (x+-1 - 1) == -1",
+ "var x:= 1; (x +- -1 - 1) == 1",
+ "var x:= 1; (x + +1 - 1) == 1",
+ "var x:= 1; (x ++1 - 1) == 1",
+ "var x:= 1; (1 - -x - 1) == 1",
+ "var x:= 1; (1 --x - 1) == 1",
+ "var x:= 1; (1-- x - 1) == 1",
+ "var x:= 1; (1--x - 1) == 1",
+ "var x:= 1; (1 -- -x - 1) == -1",
+ "var x:= 1; (1 + -x - 1) == -1",
+ "var x:= 1; (1 +-x - 1) == -1",
+ "var x:= 1; (1+- x - 1) == -1",
+ "var x:= 1; (1+-x - 1) == -1",
+ "var x:= 1; (1 +- -x - 1) == 1",
+ "var x:= 1; (1 + +x - 1) == 1",
+ "var x:= 1; (1 ++x - 1) == 1",
"var x := 1; var y := 2; 1",
"var x := 1; var y := 2; x",
"var x:=6; var y:=4; x + -3 == 3",
@@ -4623,7 +4870,43 @@
"var s := 'abc'; ~{1 + 2; 'abc' + s; s} == s ",
"var s := 'abc'; ~{1 + 2; var x := 'ab'; x + 'c'} == s ",
- "var x[10^6] := null; var y[10^7] := null; 0 * (min(x) + min(y)) + x[] + y[] == 10^7 + 10^6"
+ "var x[10^6] := null; var y[10^7] := null; 0 * (min(x) + min(y)) + x[] + y[] == 10^7 + 10^6",
+
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; if (1 < 2, v0, v1) == v0",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; if (1 > 2, v0, v1) == v1",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; if (1 < 2, v0 - v1, v1 - v0) == (v0 - v1)",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; if (1 > 2, v0 - v1, v1 - v0) == (v1 - v0)",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x := 1; var y := 2; if (x < y, v0, v1) == v0",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x := 1; var y := 2; if (x > y, v0, v1) == v1",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x := 1; var y := 2; if (x < y, v0 - v1, v1 - v0) == (v0 - v1)",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x := 1; var y := 2; if (x > y, v0 - v1, v1 - v0) == (v1 - v0)",
+
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; if (1 < 2, v0, v1) == v0",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; if (1 > 2, v0, v1) == v1",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; if (1 < 2, v0 - v1, v1 - v0) == (v0 - v1)",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; if (1 > 2, v0 - v1, v1 - v0) == (v1 - v0)",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x := 1; var y := 2; if (x < y, v0, v1) == v0",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x := 1; var y := 2; if (x > y, v0, v1) == v1",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x := 1; var y := 2; if (x < y, v0 - v1, v1 - v0) == (v0 - v1)",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x := 1; var y := 2; if (x > y, v0 - v1, v1 - v0) == (v1 - v0)",
+
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; (if (1 < 2) v0; else v1;) == v0",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; (if (1 > 2) v0; else v1;) == v1",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; (if (1 < 2) v0 - v1; else v1 - v0;) == (v0 - v1)",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; (if (1 > 2) v0 - v1; else v1 - v0;) == (v1 - v0)",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x := 1; var y := 2; (if (x < y) v0; else v1;) == v0",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x := 1; var y := 2; (if (x > y) v0; else v1;) == v1",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x := 1; var y := 2; (if (x < y) v0 - v1; else v1 - v0;) == (v0 - v1)",
+ "var v0[3] := {1,2,3}; var v1[3] := {7,8,9}; var x := 1; var y := 2; (if (x > y) v0 - v1; else v1 - v0;) == (v1 - v0)",
+
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; (if (1 < 2) v0; else v1;) == v0",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; (if (1 > 2) v0; else v1;) == v1",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; (if (1 < 2) v0 - v1; else v1 - v0;) == (v0 - v1)",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; (if (1 > 2) v0 - v1; else v1 - v0;) == (v1 - v0)",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x := 1; var y := 2; (if (x < y) v0; else v1;) == v0",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x := 1; var y := 2; (if (x > y) v0; else v1;) == v1",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x := 1; var y := 2; (if (x < y) v0 - v1; else v1 - v0;) == (v0 - v1)",
+ "var v0[3] := {1,2,3}; var v1[4] := {6,7,8,9}; var x := 1; var y := 2; (if (x > y) v0 - v1; else v1 - v0;) == (v1 - v0)",
};
const std::size_t expression_list_size = sizeof(expression_list) / sizeof(std::string);
@@ -4662,7 +4945,7 @@
}
}
- T result = expression.value();
+ const T result = expression.value();
if (T(1) != result)
{
@@ -4699,7 +4982,7 @@
continue;
}
- T result = expression.value();
+ const T result = expression.value();
if (T(1) != result)
{
@@ -4927,8 +5210,8 @@
inline bool run_test13()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
static const std::string expression_string[] =
{
@@ -5287,8 +5570,8 @@
if (not_equal(base_result,result))
{
printf("run_test15() - Error in evaluation! (1) Base: %20.10f\tResult: %20.10f\tExpression: %s\n",
- (double)base_result,
- (double)result,
+ static_cast<double>(base_result),
+ static_cast<double>(result),
expr_str_list[i].c_str());
failure = true;
@@ -5918,6 +6201,96 @@
inline bool run_test18()
{
{
+ exprtk::symbol_table<T> symbol_table;
+ symbol_table.remove_variable("x",true);
+ symbol_table.remove_variable("x",false);
+ symbol_table.remove_stringvar("x");
+ symbol_table.remove_function("x");
+ symbol_table.remove_vararg_function("x");
+ symbol_table.remove_vector("x");
+ }
+
+ {
+ exprtk::symbol_table<T> symbol_table;
+
+ {
+ T x;
+ const bool result1 = symbol_table.add_variable("x", x);
+ const bool result2 = symbol_table.remove_variable("x");
+ const bool result3 = symbol_table.remove_variable("x");
+
+ if (!result1 || !result2 || result3)
+ {
+ printf("run_test18() - Failed sym_tab add/remove [1]\n");
+ }
+ }
+
+ {
+ std::string x;
+ const bool result1 = symbol_table.add_stringvar("x", x);
+ const bool result2 = symbol_table.remove_stringvar("x");
+ const bool result3 = symbol_table.remove_stringvar("x");
+
+ if (!result1 || !result2 || result3)
+ {
+ printf("run_test18() - Failed sym_tab add/remove [2]\n");
+ }
+ }
+
+ {
+ std::vector<T> x(10,T(0));
+ const bool result1 = symbol_table.add_vector("x", x);
+ const bool result2 = symbol_table.remove_vector("x");
+ const bool result3 = symbol_table.remove_vector("x");
+
+ if (!result1 || !result2 || result3)
+ {
+ printf("run_test18() - Failed sym_tab add/remove [3]\n");
+ }
+ }
+
+ {
+ myfunc<T> x;
+ const bool result1 = symbol_table.add_function("x", x);
+ const bool result2 = symbol_table.remove_function("x");
+ const bool result3 = symbol_table.remove_function("x");
+
+ if (!result1 || !result2 || result3)
+ {
+ printf("run_test18() - Failed sym_tab add/remove [4]\n");
+ }
+ }
+
+ {
+ va_func<T> x;
+ const bool result1 = symbol_table.add_function("x", x);
+ const bool result2 = symbol_table.remove_vararg_function("x");
+ const bool result3 = symbol_table.remove_vararg_function("x");
+
+ if (!result1 || !result2 || result3)
+ {
+ printf("run_test18() - Failed sym_tab add/remove [5]\n");
+ }
+ }
+
+ {
+ symbol_table.add_function("foo1",foo1);
+ symbol_table.add_function("foo2",foo2);
+ symbol_table.add_function("foo3",foo3);
+ symbol_table.add_function("foo4",foo4);
+ symbol_table.add_function("foo5",foo5);
+ symbol_table.add_function("foo6",foo6);
+
+ symbol_table.remove_function("foo1");
+ symbol_table.remove_function("foo2");
+ symbol_table.remove_function("foo3");
+ symbol_table.remove_function("foo4");
+ symbol_table.remove_function("foo5");
+ symbol_table.remove_function("foo6");
+ }
+ }
+
+ {
typedef exprtk::expression<T> expression_t;
T x = T(1.1);
@@ -6001,8 +6374,8 @@
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
T x = T(33);
T y = T(77);
@@ -6100,8 +6473,8 @@
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
T x = T(33);
T y = T(77);
@@ -6278,8 +6651,8 @@
for (std::size_t i = 0; i < expression_list_size; ++i)
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
T x = T(33);
T y = T(77);
@@ -6395,8 +6768,8 @@
std::string s4 = "XXXXXXXXXXXXXXX";
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
symbol_table_t symbol_table;
@@ -6448,7 +6821,7 @@
return false;
}
- T result = expression.value();
+ const T result = expression.value();
if (result != T(1))
{
@@ -6508,8 +6881,8 @@
bool failure = false;
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
symbol_table_t symbol_table;
@@ -6579,8 +6952,8 @@
bool failure = false;
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
std::vector<T> v0;
std::vector<T> v1;
@@ -6666,8 +7039,8 @@
bool failure = false;
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
std::vector<T> v0;
std::vector<T> s;
@@ -6729,8 +7102,8 @@
bool failure = false;
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
std::vector<T> v0;
std::vector<T> s;
@@ -6792,8 +7165,8 @@
bool failure = false;
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
std::vector<T> v0;
std::vector<T> s;
@@ -6853,8 +7226,8 @@
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
T v0[] = { T(0), T(1), T(2), T(3), T(4) };
T v1[] = { T(5), T(6), T(7), T(8), T(9) };
@@ -6917,8 +7290,8 @@
bool failure = false;
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
exprtk::rtl::vecops::package<T> vecops_pkg;
@@ -7041,7 +7414,7 @@
continue;
}
- T result = expression.value();
+ const T result = expression.value();
if (result != T(1))
{
@@ -7351,11 +7724,11 @@
template <typename T>
inline bool run_test19()
{
- typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
- typedef exprtk::function_compositor<T> compositor_t;
- typedef typename compositor_t::function function_t;
+ typedef exprtk::symbol_table<T> symbol_table_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
+ typedef exprtk::function_compositor<T> compositor_t;
+ typedef typename compositor_t::function function_t;
{
T x = T(123.123);
@@ -7564,7 +7937,7 @@
continue;
}
- T result = expression.value();
+ const T result = expression.value();
if (result_list[i] != result)
{
@@ -8061,15 +8434,15 @@
{
x = static_cast<T>(i);
- T result = expression.value();
+ const T result = expression.value();
if (not_equal(result,std::sqrt(x),T(0.0000001)))
{
printf("run_test19() - Computation Error "
"Expression: [%s]\tExpected: %12.8f\tResult: %12.8f\n",
expression_str.c_str(),
- (double)std::sqrt(x),
- (double)result);
+ static_cast<double>(std::sqrt(x)),
+ static_cast<double>(result));
failure = true;
}
@@ -8191,7 +8564,7 @@
sum += x;
- T result = expression.value();
+ const T result = expression.value();
if (result != sum)
{
@@ -8684,8 +9057,8 @@
inline bool run_test21()
{
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
T x = T(1.1);
T y = T(2.2);
diff --git a/readme.txt b/readme.txt
index 8e4dc46..f0d363c 100644
--- a/readme.txt
+++ b/readme.txt
@@ -59,7 +59,7 @@
(05) Functions: abs, avg, ceil, clamp, equal, erf, erfc, exp,
expm1, floor, frac, log, log10, log1p, log2,
- logn, max, min, mul, ncdf, nequal, root,
+ logn, max, min, mul, ncdf, not_equal, root,
round, roundn, sgn, sqrt, sum, swap, trunc
(06) Trigonometry: acos, acosh, asin, asinh, atan, atanh, atan2,
@@ -124,7 +124,7 @@
Library including all updates and tests can be found at the following
locations:
- (a) Download: http://www.partow.net/programming/exprtk/index.html
+ (a) Download: https://www.partow.net/programming/exprtk/index.html
(b) Repository: https://github.com/ArashPartow/exprtk
https://github.com/ArashPartow/exprtk-extras
@@ -321,7 +321,7 @@
+----------+---------------------------------------------------------+
| ncdf | Normal cumulative distribution function. (eg: ncdf(x)) |
+----------+---------------------------------------------------------+
-| nequal | Not-equal test between x and y using normalised epsilon |
+| not_equal| Not-equal test between x and y using normalised epsilon |
+----------+---------------------------------------------------------+
| pow | x to the power of y. (eg: pow(x,y) == x ^ y) |
+----------+---------------------------------------------------------+
@@ -767,8 +767,8 @@
current values assigned to the variables will be used.
typedef exprtk::symbol_table<double> symbol_table_t;
- typedef exprtk::expression<double> expression_t;
- typedef exprtk::parser<double> parser_t;
+ typedef exprtk::expression<double> expression_t;
+ typedef exprtk::parser<double> parser_t;
symbol_table_t symbol_table;
expression_t expression;
@@ -811,8 +811,8 @@
Symbol Tables]
typedef exprtk::symbol_table<double> symbol_table_t;
- typedef exprtk::expression<double> expression_t;
- typedef exprtk::parser<double> parser_t;
+ typedef exprtk::expression<double> expression_t;
+ typedef exprtk::parser<double> parser_t;
symbol_table_t symbol_table0;
symbol_table_t symbol_table1;
@@ -869,7 +869,7 @@
(2) Expression
-A structure that holds an abstract syntax tree or AST for a specified
+A structure that holds an Abstract Syntax Tree or AST for a specified
expression and is used to evaluate said expression. Evaluation of the
expression is accomplished by performing a post-order traversal of the
AST. If a compiled Expression uses variables or user defined
@@ -1342,7 +1342,7 @@
Note: In example 6 from the above set, it is assumed the user defined
-function foo has been registered as having a side_effect. By default
+function foo has been registered as having a side-effect. By default
all user defined functions are assumed to have side-effects, unless
they are configured in their constructors to not have side-effects
using the 'disable_has_side_effects' free function. For more
@@ -2322,8 +2322,8 @@
with the denoted symbol table.
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::function_compositor<T> compositor_t;
- typedef typename compositor_t::function function_t;
+ typedef exprtk::function_compositor<T> compositor_t;
+ typedef typename compositor_t::function function_t;
symbol_table_t symbol_table;
@@ -2351,11 +2351,11 @@
symbol_table that has been associated with the expression instance.
The following demonstrates how all the pieces are put together:
- typedef exprtk::symbol_table<double> symbol_table_t;
+ typedef exprtk::symbol_table<double> symbol_table_t;
typedef exprtk::expression<double> expression_t;
- typedef exprtk::parser<double> parser_t;
+ typedef exprtk::parser<double> parser_t;
typedef exprtk::function_compositor<double> compositor_t;
- typedef typename compositor_t::function function_t;
+ typedef typename compositor_t::function function_t;
foo<double> f;
boo<double> b;
@@ -2747,7 +2747,7 @@
then compiled and later on evaluated:
typedef exprtk::symbol_table<double> symbol_table_t;
- typedef exprtk::expression<double> expression_t;
+ typedef exprtk::expression<double> expression_t;
// Setup global constants symbol table
symbol_table_t glbl_const_symbol_table;
@@ -2908,8 +2908,8 @@
component.
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
symbol_table_t unknown_var_symbol_table;
@@ -2981,8 +2981,8 @@
simple user defined USR:
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
template <typename T>
struct my_usr : public parser_t::unknown_symbol_resolver
@@ -3458,8 +3458,8 @@
...
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
typedef typename parser_t::settings_store settings_t;
@@ -3511,8 +3511,8 @@
" return [x, y, x + y, x - y, 'return-call 3'] ";
typedef exprtk::symbol_table<double> symbol_table_t;
- typedef exprtk::expression<double> expression_t;
- typedef exprtk::parser<double> parser_t;
+ typedef exprtk::expression<double> expression_t;
+ typedef exprtk::parser<double> parser_t;
symbol_table_t symbol_table;
expression_t expression;
@@ -3574,8 +3574,8 @@
values.
typedef exprtk::symbol_table<double> symbol_table_t;
- typedef exprtk::expression<double> expression_t;
- typedef exprtk::parser<double> parser_t;
+ typedef exprtk::expression<double> expression_t;
+ typedef exprtk::parser<double> parser_t;
std::string expression_string =
" var x := 123.456; "
@@ -3751,8 +3751,8 @@
file I/O package is made available for the given expression:
typedef exprtk::symbol_table<T> symbol_table_t;
- typedef exprtk::expression<T> expression_t;
- typedef exprtk::parser<T> parser_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
exprtk::rtl::io::file::package<T> fileio_package;
@@ -3980,9 +3980,9 @@
variable of integration can either be passed as a reference or as a
name in string form. Example usage of the function is as follows:
- typedef exprtk::parser<T> parser_t;
- typedef exprtk::expression<T> expression_t;
typedef exprtk::symbol_table<T> symbol_table_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
std::string expression_string = "sqrt(1 - (x^2))";
@@ -4015,9 +4015,9 @@
reference or as a name in string form. Example usage of the derivative
function is as follows:
- typedef exprtk::parser<T> parser_t;
- typedef exprtk::expression<T> expression_t;
typedef exprtk::symbol_table<T> symbol_table_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
std::string expression_string = "sqrt(1 - (x^2))";
@@ -4054,9 +4054,9 @@
a name in string form. Example usage of the second_derivative function
is as follows:
- typedef exprtk::parser<T> parser_t;
- typedef exprtk::expression<T> expression_t;
typedef exprtk::symbol_table<T> symbol_table_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
std::string expression_string = "sqrt(1 - (x^2))";
@@ -4093,9 +4093,9 @@
a name in string form. Example usage of the third_derivative function
is as follows:
- typedef exprtk::parser<T> parser_t;
- typedef exprtk::expression<T> expression_t;
typedef exprtk::symbol_table<T> symbol_table_t;
+ typedef exprtk::expression<T> expression_t;
+ typedef exprtk::parser<T> parser_t;
std::string expression_string = "sqrt(1 - (x^2))";
@@ -4310,7 +4310,7 @@
of that symbol-table, otherwise the result will be undefined
behavior.
- (10) Equal and Nequal are normalised-epsilon equality routines,
+ (10) Equal and not_equal are normalised-epsilon equality routines,
which use epsilons of 0.0000000001 and 0.000001 for double and
float types respectively.
@@ -4517,9 +4517,9 @@
int main()
{
typedef exprtk::symbol_table<double> symbol_table_t;
- typedef exprtk::expression<double> expression_t;
- typedef exprtk::parser<double> parser_t;
- typedef exprtk::parser_error::type error_t;
+ typedef exprtk::expression<double> expression_t;
+ typedef exprtk::parser<double> parser_t;
+ typedef exprtk::parser_error::type error_t;
std::string expression_str =
"z := 2 myfunc([4 + sin(x / pi)^3],y ^ 2)";