Boost logo

Boost :

Subject: Re: [boost] function_traits and functors
From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2008-09-24 18:15:50

Steven Watanabe wrote:
> Michael Marcin wrote:
>> Is it possible to use function_traits to decompose functors?
> No. Functors can be overloaded or templated.

I see that makes sense but I still really want to do it. :)

Maybe if I provide overloads based on is_bind_expression sfinae to know
if it is a bind I can find the type of the first argument of bind
somehow? Then I can add overloads for real functions and boost::function
to do the same.

I basically want to be able to pass any function or functor in and make
sure its first parameter is a boost::shared_ptr<T> where T could be any
type and then additionally find out what type T is.

I have a hard time reading the documentation but the proposed Boost
Channel library* seems to require callbacks to take a shared_ptr<void>
as the message data. I don't want the users to have to downcast this
themselves. Instead I want to wrap the message handlers in a function
object that will downcast the shared_ptr<void> to the appropriate type
and then call the user handler.



Michael Marcin

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