Boost Users :
Subject: Re: [Boost-users] [bind] deduce arguments types
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2011-09-01 02:43:13
On Thursday, September 01, 2011 12:15:12 AM Martin HÃ¤fner wrote:
> Hi all,
> The problem now is that I want to deduce the result type of the given
> actor as well as the argument type. Retrieving the result type is
> manageable with boost binders but I have no idea how I could retrieve
> the argument type in order to do a proper conversion from char* to int
> without the usage of make_adaptable<> which breaks the elegance of the
> binder usage at this point.
> My self-written binder class exposes appropriate typedefs so the
> writer of the parser grammar does not have to cope with all that
> 'magic' template stuff, but I cannot get a working solution for
> boost::bind nor do I get a working solution with tr1 binders.
> Maybe anybody could help or at least could explain me why the boost
> classes do not define these simple typedefs?
You lost me. The type of the arguments isn't known until the bound function is
called. That is, for example, if you have a placeholder inside your bind
expression, what would that type be? And this is one of the easier usecases
... It gets more complicated once you have nested calls to bind, or use some
You might want to look into Phoenix. Phoenix lets you introspect the passed
lambda with proto.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net