title: Using Boost/odeint with class (calling integrate from outside the class with ODE-function inside the class)
body: <p>I have written a lot of code that got VERY messy over the last couple of weeks/months and I wanted to clean up, by putting most of it into classes. However, I can't figure out, how to call an ODE-function, that is <em>inside</em> a class with Boost/integrate from <em>outside</em> the class. I'm not sure, if this is the cleanest/best practise, but I tried something like this:</p>
  <pre><code>class ODEclass
  {
  public:
      // Lots of stuff here (initialization, methods, properties, parameters)
      void odefun(std::vector&lt;double&gt; x, std::vector&lt;double&gt;&amp; dxdt, const double t)
      {
          // ...
      }
  }
  </code></pre>
  <p>And then calling somewhere outside the class:</p>
  <pre><code>integrate_adaptive(make_controlled&lt;runge_kutta_cash_karp54&lt;std::vector&lt;double&gt;&gt;&gt;(errTol[0], errTol[1]), odefun, Data, 0.0, something, something);
  </code></pre>
  <p>With <code>odefun</code> as <code>ODEclass::odefun</code>, <code>ODEinstance.odefun</code>, <code>ODEinstance-&gt;odefun</code> and every other way I could think of, but nothing works. Putting a <code>void odefun(...)</code> outside the class works perfectly fine, but that would go against my current cleaning urge.</p>
  <p>I found answers here on Stackoverflow that would use <code>std::bind</code>, but those do odeint-calls form <em>inside</em> that class and don't seem to work in my case.</p>
  <p>So how can I pass an ODE-function to odeint that is inside a class? Or is there a better (clean) way to do this? I hope, I put all the necessary information in here. If something is missing, please let me know.</p>