Boost logo

Boost :

Subject: Re: [boost] painless currying
From: Larry Evans (cppljevans_at_[hidden])
Date: 2011-09-03 09:38:05

On 09/03/11 08:28, Larry Evans wrote:
> With the 2 attached files (compiled with gcc4.6 and with boost trunk
> [which svn update showed was revision 74198]), the output is:
> which shows several copy CTOR's executed. These copy CTOR
> calls were caused by the code like this:
> curryable (Fun f, Arg0 a0, Arg1 a1, Arg2 a2):
> fun (f),
> arg0 (a0),
> arg1 (a1),
> arg2 (a2)
> {
> }
> produced by the BOOST_PP code. Is there any way to prevent
> these copies, maybe by declarations like:
> Arg0 const&
> arg0;
> instead of the existing:
> Arg0
> arg0;
> ?
OOPS. I should have thought a bit more. The reason:

  Arg0 const& arg0;

won't work is because the arguments to the curryable CTOR:

  curryable (Fun f, Arg0 a0):

maybe be gone by the time f is actually called, and that's
why they have to be copied.

Sorry for noise :(


Boost list run by bdawes at, gregod at, cpdaniel at, john at