Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-03-02 14:55:21


Andy Little wrote:
> "Jonathan Turkanis" <technews_at_[hidden]> wrote
>> Andy Little wrote:
>
>>> IOW the args are 'sugar' in the function pointer/ref case.
>>
>> Hmmm ... interesting. That seems to be what TR1 says. Do you know
>> why this is?
>
> Not really....but the only useful data to result_of in the function
> pointer typedef is the return type, while in the case of
> function-objects the arguments are potent.

I realize this. I'm just saying that if someone has a unary function pointer
type f and queries

     result_of<f(int, int)>::type

she's probably making a mistake, and it would be useful for the compiler to let
her know. (Of course the mistake will probably show up somewhere else too.)

> IOW where T is a function-pointer, T describes it completely ;
> whereas where T is a function-object, the T(a,b,c) syntax is essential.
>
> Therefore when T is a function-pointer, reference or straight
> function type result_of<T>::type would seem to me to be a valid
> invocation.

One of the main points (if not the main point) of result_of is to provide a
uniform syntax, so you don't have to worry what sub category of callable objects
you're dealing with.

> regards
> Andy Little

Jonathan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk