|
Boost Users : |
Subject: Re: [Boost-users] [result_of] member function
From: er (erwann.rogard_at_[hidden])
Date: 2009-03-02 21:31:39
Steven Watanabe wrote:
> AMDG
>
> er wrote:
>> Thak you for your answer. I was probably misinterpreting the part that
>> reads
>>
>> The implementation permits the type F to be a function pointer,
>> function reference, member function pointer, or class type.
>>
>>
>> in the doc of result_of. Is someone aware of an example that
>> illustrates the "member function pointer" part?
>
> It works like this:
>
> struct S {
> int f(int);
> }
> typedef int (S::*f_type)(int);
> typedef boost::result_of<f_type(S*, int)>::type f_result_type;
>
> Note that this is not very useful if you want to deduce the return
> type of the function named f in some arbitrary class, because you
> need to know the type of the member function pointer to
> use result_of.
>
> In Christ,
> Steven Watanabe
Thank you for your answer. As a side issue:
If F is a class and
F() returns F::T&;
F const () returns F::T const &
result_of<F const ()> will return T& if F::result_type == T&,
and void if result_type is not defined?
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