Peter Dimov wrote:
Ian McCulloch wrote:
Peter Dimov wrote:
Mini-result_of-tutorial:
Q: What do I write in the space marked ??? below:
template
??? apply( F f, A1 & a1, ..., An & an ) { return f( a1, ..., an ); } A:
typename result_of
::type. Is there any way to handle implicit conversions?
No, if I understand your question correctly. That is, from the caller's point of view there is nothing to handle: you just pass the types of a1, ..., an to result_of. However writing the correct result_of specialization for a function object that is not templated on its argument types, but has two or more operator() overloads and relies on implicit conversions would be a major pain.
Do you have a use case in mind?
Yes, if you want to forward to a function but you don't know if it takes arguments by value or const reference. I guess one could insist on using call_traits throughout, that is probably good enough for my application.