From: Anthony Williams (anthony.williamsNOSPAM_at_[hidden])
Date: 2002-11-22 04:05:18


David Abrahams writes:
>
> Do we have any precedent for ways to find out what the arity and
> argument types of an arbitrary function object is (I'm not talking
> about function pointers, here, but "functors")?

Given that a functor might support more than one argument set, the only way I
can think of is to say "do you support this argument set?" rather than "what
argument set do you accept?"; in which case you can use the mechanism
implemented in boost.lambda, and in my function composition library, to deduce
the return type --- have a member template that takes a typelist representing the
arguments you wish to pass, and returns the corresponding return type where
that argument set is valid, or something else (such as invalid_argument_set)
where it isn't (assuming you want to do something else in the case where it
isn't, rather than just abort compilation)

Does this give you what you want?

Anthony

-- 
Anthony Williams
Senior Software Engineer, Beran Instruments Ltd.
Remove NOSPAM when replying, for timely response.