|
Boost : |
Subject: Re: [boost] [function] why do I function1 for type-of emulation?
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2012-04-10 16:57:16
Steven Watanabe-4 wrote
>
> AMDG
>
> On 04/10/2012 12:01 PM, lcaminiti wrote:
>> Hello all,
>>
>> I was trying to use Boost.Function together with Boost.Typeof. It seems
>> that
>> if I run in type-of emulation mode I have to register boost::functionN
>> instead of boost::function even if I only use boost::function... do you
>> know
>> why?
>> <snip>
>>
>
> Because the type of &boost::function<int(int)>::operator()
> is int (boost::function1<int, int>::*)(int)
> The type of a member function pointer is
> determined by the class that it is declared in,
> not the class that it is accessed through.
>
Got it! In fact looking at the code:
template<typename R, typename T0>
class function1 : public function_base, public std::unary_function<T0,R>
{
public:
result_type operator()( T0 a0) const ;
...
};
template<typename R, typename T0>
class function<R ( T0)>
: public function1<R , T0>
{
...
};
However, the docs say that operator() is defined in function and not just in
its public base functionN:
http://www.boost.org/doc/libs/1_49_0/doc/html/boost/function.html#id427205-bb
Maybe this should be corrected.
Thanks a lot for the clarification!
--Lorenzo
-- View this message in context: http://boost.2283326.n4.nabble.com/boost-function-why-do-I-function1-for-type-of-emulation-tp4546601p4546942.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk