Boost logo

Boost Users :

Subject: Re: [Boost-users] [signals] maximum combiner example calls slot twice
From: Frank Mori Hess (fmhess_at_[hidden])
Date: 2009-04-24 13:41:41


On Friday 24 April 2009, Dominique Devienne wrote:
> In http://www.boost.org/doc/libs/1_38_0/doc/html/signals/tutorial.html,
> once I read:
>
> "The input iterators passed to the combiner transform dereference
> operations into slot calls"
>
> I realized that the maximum<T> combiner introduced earlier is
> implemented using:
>
> if (max_value < *first)
> max_value = *first;
>
> Which ends up calling the slot twice.

Dereferencing a slot call iterator multiple times only runs the slot once.
After that, it returns a cached copy of the return value.




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net