Boost logo

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
> 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&lt;int(int)&gt;::operator()
> is int (boost::function1&lt;int, int&gt;::*)(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>
    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:
Maybe this should be corrected.

Thanks a lot for the clarification!

View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at