|
Boost : |
Subject: Re: [boost] Interest in a tweener library
From: Julien Jorge (julien.jorge_at_[hidden])
Date: 2012-07-15 08:31:44
Le Sun, 15 Jul 2012 13:37:06 +0200,
Klaim - Joël Lamotte <mjklaim_at_[hidden]> a écrit :
> I see.
>
> Did you consider copying the value instead of keeping a reference to
> it? Also, what do you think about allowing the user to use one or the
> other?
Sorry I made a mistake in the code that results in a misunderstanding.
The argument of the function g() should not be a reference:
void g( boost::function<double (double)> func )
{
double t = /* ⦠*/;
double d = func( t );
// â¦
}
int main()
{
g( &f );
}
Thus, it is a copy of the function object. There is no reason to keep a
reference to the boost::function here.
Julien Jorge
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk