Boost logo

Boost Users :

From: Ian McCulloch (ianmcc_at_[hidden])
Date: 2005-03-15 21:21:24


Peter Dimov wrote:

> Ian McCulloch wrote:
>> Peter Dimov wrote:
>>
>>> Mini-result_of-tutorial:
>>>
>>> Q: What do I write in the space marked ??? below:
>>>
>>> template<class F, class A1, ..., class An> ??? apply( F f, A1 & a1,
>>> ..., An & an )
>>> {
>>> return f( a1, ..., an );
>>> }
>>>
>>> A:
>>>
>>> typename result_of<F(A1&, ..., An&)>::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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net