
Tim Song wrote:
On Mon, Apr 10, 2017 at 2:48 PM, Peter Dimov via Boost <boost@lists.boost.org> wrote:
The obvious theoretically consistent approach here is
void(foo::*)(float, char, int) -> tuple<foo, float, char, int>
It depends on what the theory is.
What I wanted (and failed) to express by "theoretically consistent" wasn't "consistent with a theory" but "consistent, in theory". That is, consistent, but not necessarily a better choice in practice.
If the model is "type of the implicit object parameter during overload resolution", then foo& is the correct choice (see [over.match.funcs]/4).
That would be useful if you want to perform overload resolution on the tuple, which you probably don't. I acknowledged that foo& is more useful. One example is when given a member pointer pmf you want for some reason to derive its corresponding std::function. That would be function< apply_return_t<args_t<PMF>, return_type_t<PMF>> > and here we do want foo&. We'd prefer a reversible tuple if we wanted to manipulate the argument list (assuming that the built-in facilities are removed) and then go from the tuple back to a member pointer. Although in this case it would probably be more convenient if we just drop the class and keep the original member pointer to retain it (along with the return type and noexcept which can't go in the tuple anyway.)