16 Apr
2009
16 Apr
'09
3:40 p.m.
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.