c++ - Assembling a function as needed and computing it fast -


there interpreted languages out there, such lisp, tcl, perl, etc., make easy define lambda/proc/sub within code during runtime , evaluate within same session.

there compiled languages out there, such c++, execute faster interpreted ones, yet defining function within compiled program during runtime , executing not easy, if @ possible.

the problem here following:

  1. define function during runtime: example, based on initial input data derive analytic model of data.

  2. execute above function fast in loop: example, apply derived analytic model analysing incoming data.

one solution saw not pretty:

  1. a procedure representing analytic model derived in embedded tcl based on initial input data.

  2. a lookup table created evaluating procedure in tcl on array of sample points that, optimistically speaking, cover applicability range.

  3. the lookup table passed tcl interpreter binary (which developed in c++).

  4. then incoming data analysed interpolating between "close enough" values in lookup table.

the above solution works, has quite few problems, both conceptual , computational. question: possible define function purely within c++ , make available execution within same runtime session?

conceptually speaking, possible create function string, compile in-memory, , somehow link binary that's being executed?

if want working right out of box have @ exprtk. if want write expression parser check out boost spirit.

an alternative create c++ code on fly, compile shared library (plugin) , load @ runtime. fastest solution.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -