From: David Abrahams (dave_at_[hidden])
Date: 2002-11-22 07:21:26
Anthony Williams <anthony.williamsNOSPAM_at_[hidden]> writes:
> 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?
No, the inputs are fully-polymorphic Python objects. If I knew what
"arguments I wish to pass", I'd be all set. I'm only interested in the
cases where that's deducible from the function object. For the other
cases, the user can pass me a type sequence directly.
-- David Abrahams dave_at_[hidden] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk