From: "David Abrahams" <[EMAIL PROTECTED]> > "Peter Dimov" <[EMAIL PROTECTED]> writes: > > > On the other hand... the ((*p).*f)(...) form would work with most smart > > pointers and iterators, so it might be worth exploring. > > Yes, and in particular it would work with std::auto_ptr, which I know > is not a candidate for bind because it's not CopyConstructible, but it > is important for other reasons.
It's fairly easy to provide a get_pointer for std::auto_ptr. ;-) It ought to be in std:: but a boost:: overload would do as well since the pointer version is in boost. boost/get_pointer.hpp? > Maybe the thing to do is to provide a generalized get_pointer template > which does &*p. This doesn't allow p to be NULL; get_pointer has no such requirement. > And now, on to a tougher problem: > > What's the generic form to use for checking whether a Dereferenceable > type is NULL? get_pointer(p) != 0? > The only forms which work for std::auto_ptr is: > > !p.get() > !p.operator->() > > I'd use the second one for all class types, but STLPort's debug mode > asserts instead of returning 0. It's a nonconforming but IMHO very > reasonable extension :(. It won't work for scoped/shared_ptr either, and I haven't forgot the != 0 requirement in operator->. ;-) _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost