
On Thursday, September 01, 2011 12:15:12 AM Martin Häfner wrote:
Hi all, <snip> 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 operators. You might want to look into Phoenix. Phoenix lets you introspect the passed lambda with proto.
Regards, Martin