"Mark Storer"
So why won't std::mem_fun work through boost::shared_ptr's operator->?
Here's the mem_fun that ships with VC6:
--- template
class mem_fun_t : public unary_function<_Ty *, _R> { public: explicit mem_fun_t(_R (_Ty::*_Pm)()) : _Ptr(_Pm) {} _R operator()(_Ty *_P) const ^^^^^^^ {return ((_P->*_Ptr)()); } private: _R (_Ty::*_Ptr)(); }; --- The relevant portion to our discussion is: "{return ((_P->*_Ptr()); }" which can be further boiled down to: return _P->_Ptr();
No, the relevant part is the signature I highlighted above.
This looks an awful lot like it should work with a shared_ptr's operator->(). So why doesn't it?
It should be obvious now, I hope.
I admit that this is more of a C++ question than a boost one, but it's not too much of a tangent and I *am* curious.
All I have to say is "use boost::mem_fn, which works, and never touch the one in std::". -- Dave Abrahams Boost Consulting http://www.boost-consulting.com