How to use exprtk to evaluate an equasion as bool?

262 views Asked by At

I'm trying to run this code:

exprtk::parser<bool> parser;
exprtk::expression<bool> expression;
parser.compile("5 > 6", expression);
std::cout << expression.value() << "\n";

But I get this error:

'exprtk::expression<T>::operator T(void) const': member function already defined or declared

On VS 2019. This doesn't happen when I use other data types. Is this a bug or am I doing something wrong?

1

There are 1 answers

2
Drew Dormann On BEST ANSWER

From the documentation:

exprtk::expression<NumericType>

Note: NumericType can be any floating point type. This includes but is not limited to: float, double, long double, MPFR or any custom type conforming to an interface comptaible (sic) with the standard floating point type.

bool is not a floating-point type.