Brian Silverman | 7c33ab2 | 2018-08-04 17:14:51 -0700 | [diff] [blame^] | 1 | [/============================================================================ |
| 2 | Boost.odeint |
| 3 | |
| 4 | Copyright 2011-2012 Karsten Ahnert |
| 5 | Copyright 2011-2012 Mario Mulansky |
| 6 | |
| 7 | Use, modification and distribution is subject to the Boost Software License, |
| 8 | Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 9 | http://www.boost.org/LICENSE_1_0.txt) |
| 10 | =============================================================================/] |
| 11 | |
| 12 | |
| 13 | [section Binding member functions] |
| 14 | |
| 15 | [import ../examples/bind_member_functions.cpp] |
| 16 | |
| 17 | Binding member functions to a function objects suitable for odeint system function is not easy, at least in C++03. The usual way of using __boost_bind does not work because of the forwarding problem. odeint provides two `do_step` method which only differ in the const specifiers of the arguments and __boost_bind binders only provide the specializations up to two argument which is not enough for odeint. |
| 18 | |
| 19 | But one can easily implement the according binders themself: |
| 20 | |
| 21 | [ode_wrapper] |
| 22 | |
| 23 | One can use this binder as follows |
| 24 | |
| 25 | [bind_member_function] |
| 26 | |
| 27 | [section Binding member functions in C++11] |
| 28 | |
| 29 | [import ../examples/bind_member_functions_cpp11.cpp] |
| 30 | In C++11 one can use `std::bind` and one does not need to implement the bind themself: |
| 31 | |
| 32 | [bind_member_function_cpp11] |
| 33 | |
| 34 | [endsect] |
| 35 | |
| 36 | [endsect] |