Home C++ exprtk - can it be used within a class?
Reply: 0

C++ exprtk - can it be used within a class?

Ernie Mur
1#
Ernie Mur Published in 2017-12-06 11:04:48Z

I want to call a function of a class from exprtk. (http://www.partow.net/programming/exprtk/)

I want to register a function with this toolkit with symbol_table.add_function. Therefore it is required to derive my class like this from ifunction provided with that toolkit:

 template <typename T>
   struct foo : public exprtk::ifunction<T>
   {
      foo() : exprtk::ifunction<T>(0)
      {}

      T operator()()
      {
         // here I want to access data from a class which owns this struct
      }
   };

Is it possible to include this struct in a way, that a class can access it and the operator() of this struct can access data in the class? One possibility would be to pass a pointer of that class to the constructor of the struct. Is there a better way?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.316584 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO