|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-01-26 18:32:24
shunsuke wrote:
> Hi, gurus.
>
> I have one question about 'result_of':
>
>
> template<class F>
> struct forward
> {
> template<class A>
> // typename boost::result_of<F(A&)>::type // (1)
> typename boost::result_of<F const(A&)>::type // (2)
> operator()(A& a) const
> {
> return m_f(a);
> }
>
> explicit forward(F f) : m_f(f)
> { }
>
> private:
> F m_f;
> };
>
>
> (1) or (2).. which is right?
(2) is right because m_f is const in operator().
> In fact, (2) fails to compile if 'F' is a function pointer type;
> because const function-pointer specialization is missing.
This is a bug in boost::result_of.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk