Boost logo

Boost Users :

Subject: Re: [Boost-users] [traits/function_types/generic] Can F be called with {a0, ..., aN}?
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2010-03-02 17:48:32


Rutger ter Borg <rutger <at> terborg.net> writes:
> So, in short, does anyone know of a generic trick to know if F can be called
> with a set parameters {a0,...,aN} (without the compile error)?

Not sure if this is what you want, but I was pointed to the following previously:
http://www.boost.org/doc/libs/1_42_0/doc/html/proto/appendices.html#boost_proto.ap
pendices.implementation.function_arity

This works for most function objects, but not for function pointers. To
implement those, I ended up doing a dispatch and determining if the arguments
were convertible.
Here is a link to my (inelegant) solution:
http://svn.econtoolkit.com/libraries/trunk/etk/etk/meta/function_traits.hpp

And my test file:
http://svn.econtoolkit.com/libraries/trunk/etk/tests/meta/test_function_traits.cpp

Also: I found that this worked fine with C++0X lambdas on Intel 11.1 but
didn't work with Phoneix, boost::lambda, or std::bind. I posted a question on
this problem for phoenix a little while ago, but didn't find a solution.


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