Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2000-11-22 13:52:07


From: "William Kempf" <sirwillard_at_[hidden]>

> As for ref-counting vs. cloning... that's a trickier question.

Indeed. :-)

> I'm
> leaning in favor of ref-counting since a callback is likely to be
> passed around frequently.

That's not obvious to me. Why is a callback likely to be passed around
frequently - in performance critical code?

> However, I'd love to hear a list of pros
> and cons from people for both strategies just to make sure I've not
> missed any that could change my opinion (and to help others formulate
> their own opinions as well).

A list of pros and cons won't help, because a cloning callback and a
reference counted callback are different concepts. Sometimes you'll need the
one, sometimes the other.

One other point that crossed my mind is that building a refcounted callback
on top of a cloning one is (relatively) easy, while the opposite is not
trivial. Assuming the compiler has void returns, of course.

--
Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk