
You may recall my earlier question asking if there was an easy way to "bind" a member
function to a weak_ptr. Looking at the lower-level STL features, I came up with this
idea, to prepare an adaptor in the same manner as mem_fun and mem_fun_ref. Generalizing
the idea, it takes a member function and produces a functor that takes the object as a
first argument, for various ways of presenting the object. I extended it with
mem_fun_weak, where the resulting functor is called with a weak_ptr as the first argument.
Below is one form (the one I need). To work along with the other STL primitives, there
are a total of 4 forms (const/non-const, one arg or no args). That doesn't have arbitrary
signatures like the more general "bind", which is something I'd like to discuss further.
For now, my question concerns the first template argument to std::binary_function.
Looking at the declarations for the standard mem_fun1_t and mem_fun1_ref_t, I don't know
if this should be:
1) the full type passed as the first argument to the resulting functor,
2) such, but without the final &,
3) just the object's type,
4..n) something else?
Can someone clarify that for me?
Here is my code (using #1 above):
template