Passing a C++ Lambda to a GSL Function
The GNU Scientific Library is a C library that offers (among other things) an
integration routine. One does not pass a simple double (*f)(double)
function
parameter because there might be additional parameters needed. The article
Currying in C lists various possibilities, the GSL
implements the variant with the void *
. A dummy implementation of this
integration routine could look like this, for the purpose of this article: