Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-08-27 09:36:18

From: "Douglas Gregor" <gregod_at_[hidden]>
> >
> > Also, get_pointer for weak_ptr was deliberately omitted as dangerous.
> > do you need it?
> void bar(weak_ptr<X> x)
> {
> some_signal.connect(bind(&X::foo, x));
> }
> We need to get to the X* for the base-pointer conversion to trackable*
> the automatic signal/slot disconnections).

But that's exactly why I didn't add get_pointer for weak_ptr. bind(&X::foo,
x) is only valid when get_pointer is present; but there is no reason to bind
a member function to a weak pointer, because you can't detect from within
the member function whether "this" is zero (meaning that the weak pointer
has been zeroed.)

> I guess it wouldn't be terribly
> horrible if the Signals library just relied on forward declarations and
> .get() to elimate the dependencies and not introduce the dependency on
> type_traits/ice.hpp, if that would be preferable.

Relying on get_pointer is OK (once we get the weak_ptr situation sorted
out), but I'd like to keep the smart pointer headers as dependency free as

Boost list run by bdawes at, gregod at, cpdaniel at, john at