]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/numeric/odeint/doc/details_boost_ref.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / numeric / odeint / doc / details_boost_ref.qbk
CommitLineData
7c673cae
FG
1[/============================================================================
2 Boost.odeint
3
4 Copyright 2012 Karsten Ahnert
5 Copyright 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[section Using boost::ref]
13
14In odeint all system functions and observers are passed by value. For example, if you call a `do_step` method of a particular stepper or the integration functions, your system and your stepper will be passed by value:
15
16[c++]
17``
18rk4.do_step( sys , x , t , dt ); // pass sys by value
19``
20
21This behavior is suitable for most systems, especially if your system does not contain any data or only a few parameters. However, in some cases you might contain some large amount of data with you system function and passing them by value is not desired since the data would be copied.
22
23In such cases you can easily use `boost::ref` (and its relative `boost::cref`)
24which passes its argument by reference (or constant reference). odeint will
25unpack the arguments and no copying at all of your system object will take place:
26
27``
28rk4.do_step( boost::ref( sys ) , x , t , dt ); // pass sys as references
29``
30
31The same mechanism can be used for the observers in the integrate functions.
32
33[tip If you are using C++11 you can also use `std::ref` and `std::cref`]
34
35[endsect]