I'm working on a software library, where one of the headers is written like this:
#include "exprtk.hpp"
class ExprtkWrapper {
typedef exprtk::symbol_table<double> symbol_table_t;
typedef exprtk::expression<double> expression_t;
typedef exprtk::parser<double> parser_t;
public:
API ExprtkWrapper( std::string expression_string );
API ExprtkWrapper( );
API ~ExprtkWrapper();
API double eval(double x1 = 0.0, double x2 = 0.0, double x3 = 0.0, double x4 = 0.0);
API double eval(std::vector<double> &p);
private:
expression_t *expression = nullptr;
symbol_table_t *symbol_table = nullptr;
parser_t * parser = nullptr;
};
It needs exprtk
library to work. The problem is, that exprtk.hpp
is a header-only library and I don't want it to be copied wherever I include my header. Is there any elegant way to rewrite the header to get exprtk.hpp
to the corresponding .cpp file?
I've tried simply rewriting my class into the cpp file and leaving just declaration in the header, but then I'm getting the error:
error: invalid use of incomplete type ‘class ExprtkWrapper’