24 Apr
2009
24 Apr
'09
5:41 p.m.
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.