Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-users][bind, lambda, ...] binding unused actual parameter
From: Igor R (boost.lists_at_[hidden])
Date: 2009-04-16 11:40:11


> Implementation of mem_fn makes unqualified calls to get_pointer, hence you
> can define get_pointer in the namespace of your smart pointer (function will
> be found by ADL). I think it's also OK to overload boost::get_pointer,
> because it's a deliberate point of extension.

Well, it turns out that defining get_pointer() for ATL::CComPtr won't
help, because CComPtrBase defines its own operator&(), doing this in a
pretty weird way (quote from atlcomcli.h):

        //The assert on operator& usually indicates a bug. If this is really
        //what is needed, however, take the address of the p member explicitly.
        T** operator&() throw()
        {
                ATLASSERT(p==NULL);
                return &p;
        }

So the "double bind" is the only short way to do this.


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