How does one define and return a function inside a function?
For instance, we have a function like:
float foo(float val) {return val * val;}
Use std::function
std::function bar(float coeff) { auto f = [coeff](float x) { return coeff * foo(x); }; return f; }
You would then use it like this:
auto f = bar(coeff); auto result = f(x);