C++ Mathematical Expression Toolkit (ExprTk) release
Loading...
Searching...
No Matches
Classes | Functions
exprtk_symtab_functions.cpp File Reference
#include <cstdio>
#include <string>
#include "exprtk.hpp"
Include dependency graph for exprtk_symtab_functions.cpp:

Go to the source code of this file.

Classes

struct  myfunc< T >
 

Functions

template<typename T >
myotherfunc (T v0, T v1, T v2)
 
template<typename T >
void symbol_table_function_names ()
 
int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 68 of file exprtk_symtab_functions.cpp.

69{
70 symbol_table_function_names<double>();
71 return 0;
72}

◆ myotherfunc()

template<typename T >
T myotherfunc ( v0,
v1,
v2 
)
inline

Definition at line 42 of file exprtk_symtab_functions.cpp.

43{
44 return std::abs(v0 - v1) * v2;
45}

Referenced by symbol_table_function_names().

Here is the caller graph for this function:

◆ symbol_table_function_names()

template<typename T >
void symbol_table_function_names ( )

Definition at line 48 of file exprtk_symtab_functions.cpp.

49{
50 typedef exprtk::symbol_table<T> symbol_table_t;
51
52 symbol_table_t symbol_table;
53
54 myfunc<T> mf;
55
56 symbol_table.add_function("f1",[](T v0) -> T { return v0;});
57 symbol_table.add_function("f2",[](T v0, T v1) -> T{ return v0 / v1;});
58
59 symbol_table.add_function("myfunc" , mf );
60 symbol_table.add_function("otherfunc", myotherfunc);
61
62 for (const auto& func : symbol_table.get_function_list())
63 {
64 printf("function: %s\n",func.c_str());
65 }
66}
T myotherfunc(T v0, T v1, T v2)

References myotherfunc().

Here is the call graph for this function: