From d7dfe94e112dcab9554628b1a54e027cdaa26a77 Mon Sep 17 00:00:00 2001 From: Arash Partow Date: Thu, 30 Apr 2015 23:21:26 +1000 Subject: [PATCH] C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html --- exprtk.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/exprtk.hpp b/exprtk.hpp index a78fb0a..2aea379 100644 --- a/exprtk.hpp +++ b/exprtk.hpp @@ -170,6 +170,16 @@ namespace exprtk is_digit(symbol[3]); } + inline const char& front(const std::string& s) + { + return s[0]; + } + + inline const char& back(const std::string& s) + { + return s[s.size() - 1]; + } + inline std::string to_str(int i) { if (0 == i) @@ -32073,8 +32083,8 @@ namespace exprtk } if ( - ('{' == expression.front()) && - ('}' == expression.back ()) + ('{' == details::front(expression)) && + ('}' == details::back (expression)) ) mod_expression += "~" + expression + ";"; else