Boost logo

Boost Users :

Subject: [Boost-users] [signals] maximum combiner example calls slot twice
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2009-04-24 12:07:15


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. In this case it's harmless since
the slot has no side effect, but it may not be a good example to
follow, or maybe it should be pointed out a little later when the
combiner deref statement quoted above is made. Just my $0.02. Thanks,
--DD


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