Posted by
Luigi Ballabio on
Jun 03, 2010; 4:17pm
URL: http://quantlib.414.s1.nabble.com/quantlib-Handle-compile-error-tp7722p7733.html
On Tue, 2010-05-25 at 18:29 -0500, Kakhkhor Abdijalilov wrote:
> But I've got another questions. Why Observable and Observer store
> their connections in std::list? Could std::set be a better choice?
They're probably equivalent. The only difference in behavior (*) would
be if one observer registers twice with the same observable---twice
directly, not indirectly (if A registers with B and C, and B registers
with C, that doesn't count as A observing C twice---the two pointers to
C would go in different containers.) This shouldn't happen, so I didn't
give it much thought.
Luigi
(*) apart from list being O(1) insertion and O(N) deletion, and set
being O(log N) insertion and O(log N) deletion, if I'm not mistaken.
Iterating to notify all observers would be O(N) in both cases.
--
There are two ways to write error-free programs; only the third one
works.
-- unknown
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users