5 Jan
2005
5 Jan
'05
1:28 p.m.
On Wed, 05 Jan 2005 14:11:19 +1100, Trent Hill
I was recently surprised to find that boost::bind seems to copy arguments a number of times when called. For example, this program:
Use boost::ref or boost::cref. From the docs (http://boost.org/libs/bind/bind.html): ---8<--- a copy of the value of i is stored into the function object. boost::ref and boost::cref can be used to make the function object store a reference to an object, rather than a copy: int i = 5; bind(f, ref(i), _1); ---8<--- -- Caleb Epstein caleb dot epstein at gmail dot com