diff --git a/Makefile b/Makefile index e7702ed..d81702c 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # ************************************************************** # * C++ Mathematical Expression Toolkit Library * # * * -# * Author: Arash Partow (1999-2014) * +# * Author: Arash Partow (1999-2015) * # * URL: http://www.partow.net/programming/exprtk/index.html * # * * # * Copyright notice: * diff --git a/exprtk.hpp b/exprtk.hpp index 5d73cd7..7581c4c 100644 --- a/exprtk.hpp +++ b/exprtk.hpp @@ -2,7 +2,7 @@ ****************************************************************** * C++ Mathematical Expression Toolkit Library * * * - * Author: Arash Partow (1999-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * @@ -6540,7 +6540,8 @@ namespace exprtk typedef typename range_t::cached_range_t cached_range_t; generic_string_range_node(expression_ptr str_branch, range_t brange) - : branch_(str_branch), + : initialised_(false), + branch_(str_branch), branch_deletable_(branch_deletable(branch_)), str_base_ptr_ (0), str_range_ptr_(0), @@ -6563,6 +6564,8 @@ namespace exprtk if (0 == str_range_ptr_) return; } + + initialised_ = (str_base_ptr_ && str_range_ptr_); } ~generic_string_range_node() @@ -6578,7 +6581,7 @@ namespace exprtk inline T value() const { - if (str_base_ptr_ && str_range_ptr_) + if (initialised_) { branch_->value(); @@ -6641,8 +6644,9 @@ namespace exprtk private: - expression_ptr branch_; - bool branch_deletable_; + bool initialised_; + expression_ptr branch_; + bool branch_deletable_; str_base_ptr str_base_ptr_; irange_ptr str_range_ptr_; mutable range_t base_range_; @@ -6670,6 +6674,7 @@ namespace exprtk expression_ptr branch0, expression_ptr branch1) : binary_node(opr,branch0,branch1), + initialised_(false), str0_base_ptr_ (0), str1_base_ptr_ (0), str0_range_ptr_(0), @@ -6705,16 +6710,16 @@ namespace exprtk if (0 == str1_range_ptr_) return; } + + initialised_ = str0_base_ptr_ && + str1_base_ptr_ && + str0_range_ptr_ && + str1_range_ptr_ ; } inline T value() const { - if ( - str0_base_ptr_ && - str1_base_ptr_ && - str0_range_ptr_ && - str1_range_ptr_ - ) + if (initialised_) { binary_node::branch_[0].first->value(); binary_node::branch_[1].first->value(); @@ -6779,6 +6784,7 @@ namespace exprtk private: + bool initialised_; str_base_ptr str0_base_ptr_; str_base_ptr str1_base_ptr_; irange_ptr str0_range_ptr_; @@ -6805,6 +6811,7 @@ namespace exprtk swap_string_node(expression_ptr branch0, expression_ptr branch1) : binary_node(details::e_swap,branch0,branch1), + initialised_(false), str0_node_ptr_(0), str1_node_ptr_(0) { @@ -6817,14 +6824,13 @@ namespace exprtk { str1_node_ptr_ = static_cast(binary_node::branch_[1].first); } + + initialised_ = (str0_node_ptr_ && str1_node_ptr_); } inline T value() const { - if ( - str0_node_ptr_ && - str1_node_ptr_ - ) + if (initialised_) { binary_node::branch_[0].first->value(); binary_node::branch_[1].first->value(); @@ -6867,6 +6873,7 @@ namespace exprtk private: + bool initialised_; strvar_node_ptr str0_node_ptr_; strvar_node_ptr str1_node_ptr_; }; @@ -6992,6 +6999,7 @@ namespace exprtk expression_ptr branch0, expression_ptr branch1) : binary_node(opr,branch0,branch1), + initialised_(false), str0_base_ptr_ (0), str1_base_ptr_ (0), str0_node_ptr_ (0), @@ -7018,16 +7026,16 @@ namespace exprtk str1_range_ptr_ = &(range_ptr->range_ref()); } + + initialised_ = str0_base_ptr_ && + str1_base_ptr_ && + str0_node_ptr_ && + str1_range_ptr_ ; } inline T value() const { - if ( - str0_base_ptr_ && - str1_base_ptr_ && - str0_node_ptr_ && - str1_range_ptr_ - ) + if (initialised_) { binary_node::branch_[1].first->value(); @@ -7081,6 +7089,7 @@ namespace exprtk private: + bool initialised_; str_base_ptr str0_base_ptr_; str_base_ptr str1_base_ptr_; strvar_node_ptr str0_node_ptr_; @@ -7107,6 +7116,7 @@ namespace exprtk expression_ptr branch0, expression_ptr branch1) : binary_node(opr,branch0,branch1), + initialised_(false), str0_base_ptr_ (0), str1_base_ptr_ (0), str0_node_ptr_ (0), @@ -7141,17 +7151,17 @@ namespace exprtk str1_range_ptr_ = &(range_ptr->range_ref()); } + + initialised_ = str0_base_ptr_ && + str1_base_ptr_ && + str0_node_ptr_ && + str0_range_ptr_ && + str1_range_ptr_ ; } inline T value() const { - if ( - str0_base_ptr_ && - str1_base_ptr_ && - str0_node_ptr_ && - str0_range_ptr_ && - str1_range_ptr_ - ) + if (initialised_) { binary_node::branch_[0].first->value(); binary_node::branch_[1].first->value(); @@ -7213,6 +7223,7 @@ namespace exprtk private: + bool initialised_; str_base_ptr str0_base_ptr_; str_base_ptr str1_base_ptr_; strvar_node_ptr str0_node_ptr_; @@ -30138,8 +30149,8 @@ namespace exprtk namespace information { static const char* library = "Mathematical Expression Toolkit"; - static const char* version = "2.7182818284590452353602874713526624977572470936999"; - static const char* date = "20141101"; + static const char* version = "2.7182818284590452353602874713526624977572470936999595"; + static const char* date = "20150111"; static inline std::string data() { diff --git a/exprtk_benchmark.cpp b/exprtk_benchmark.cpp index 1797d0f..f0b02f7 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_01.cpp b/exprtk_simple_example_01.cpp index 3e04617..8782c71 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_02.cpp b/exprtk_simple_example_02.cpp index fbc422c..8f8f5b0 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_03.cpp b/exprtk_simple_example_03.cpp index db8b2d0..bf39a1b 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_04.cpp b/exprtk_simple_example_04.cpp index 71381f1..22dfca9 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_05.cpp b/exprtk_simple_example_05.cpp index bb72812..2034c92 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_06.cpp b/exprtk_simple_example_06.cpp index 89faa9f..d80fe86 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_07.cpp b/exprtk_simple_example_07.cpp index 9fd8366..aa949ee 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_08.cpp b/exprtk_simple_example_08.cpp index da2f99d..96411bc 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_09.cpp b/exprtk_simple_example_09.cpp index 3b544f9..0544696 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_10.cpp b/exprtk_simple_example_10.cpp index 3af2fc2..2272026 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_11.cpp b/exprtk_simple_example_11.cpp index 3f35bae..8417b82 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_12.cpp b/exprtk_simple_example_12.cpp index 295a403..e02b9e0 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_13.cpp b/exprtk_simple_example_13.cpp index 3b12554..f5c8214 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_14.cpp b/exprtk_simple_example_14.cpp index 5ed5547..e105d9f 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_15.cpp b/exprtk_simple_example_15.cpp index 9d24b5b..8016bf5 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_16.cpp b/exprtk_simple_example_16.cpp index ac3d19b..c75f297 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_test.cpp b/exprtk_test.cpp index b10d13e..f17abed 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-2014) * + * Author: Arash Partow (1999-2015) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/readme.txt b/readme.txt index 38d9bc9..697c332 100644 --- a/readme.txt +++ b/readme.txt @@ -1171,6 +1171,7 @@ parameters and their views are as follows: (2) Vector - vector_view (3) String - string_view + The above denoted type views provide non-const reference-like access to each parameter, as such modifications made to the input parameters will persist after the function call has completed. The following @@ -1418,14 +1419,14 @@ Two specific overrides of the function operator are provided one for standard generic functions and one for string returning functions. The overrides are as follows: - // f(psi,i_0,i_1,....,i_N) --> Scalar + // Scalar <-- function(psi,i_0,i_1,....,i_N) inline T operator()(const std::size_t& ps_index, parameter_list_t parameters) { ... } - // f(psi,i_0,i_1,....,i_N) --> String + // String <-- function(psi,i_0,i_1,....,i_N) inline T operator()(const std::size_t& ps_index, std::string& result, parameter_list_t parameters) @@ -1589,6 +1590,7 @@ zero input parameters the calling styles are as follows: (2) x + sin(foo - 2) / y + [16 - EXPRESSION DEPENDENTS] Any expression that is not a literal (aka constant) will have dependencies. The types of 'dependencies' an expression can have are @@ -1816,6 +1818,7 @@ more of the following checkers: (2) Numeric Checker (3) Sequence Checker + (c) Numeric Errors This class of error is related to conversion of numeric values from their string form to the underlying numerical type (float, double @@ -1994,10 +1997,12 @@ into account when using Exprtk: default : y > 2 ? 3 : 4; }; x != while (y > 0) { y -= 1; }; - x -= {if(min(x,y) < 2 * max(x,y)) - x + 2; - else - x + y - 3;} + x -= { + if(min(x,y) < 2 * max(x,y)) + x + 2; + else + x + y - 3; + } ) { (x + y) / (x - y);