$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [boost.bind] How to retrieve the function type of a boost::bind result
From: Olaf Krzikalla (krzikalla_at_[hidden])
Date: 2009-01-27 06:10:48
Hi,
Steven Watanabe wrote:
>
> Olaf Krzikalla wrote:
>
>> template<typename T>
>> void foo(boost::function<T> func) { /*...*/ }
>>
>> void bar() {}
>>
>> void baz()
>> {
>> foo(boost::bind(&bar)); // error
>> }
>>
>> So how do I get the first line of baz to work? That is, is there a
>> generic way to compute the boost::function type from the bind result?
>
> There is not because the boost::function type is not unique.
Hmm, indeed.
However wouldn't it be possible for the bind (member) function pointer
overloads to return a "_bind_t_ex" type derived from _bind_t containing
a function_type typedef? In my particular use case I will use bind with
function pointers only.
Best regards
Olaf Krzikalla