Boost logo

Boost :

Subject: Re: [boost] determine first arg of callable
From: Jonathan Wakely (jwakely.boost_at_[hidden])
Date: 2013-05-15 05:48:59


On 15 May 2013 09:35, Oliver Kowalke wrote:
> I could overload the ctor of X for function pointers:
>
> template< typename Arg >
> X( void(*fn)( Y< Arg > &) ) {...}
>
> but how to deal with the other two callable types? result_of and
> function_traits did not work for me.

In general there is no unique argument_type for callable objects, they
could have overloaded function call operators.

If http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3579.html
makes it into the standard you could find out the argument type *for a
given invocation* i.e. you can ask "what is the type of the first
argument when called as f(x, y, z)", but not "what is the
argument_type of F"


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk