Boost logo

Boost :

Subject: Re: [boost] Getting the types of arguments for a bind.
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-10-10 17:19:24


Michael Marcin wrote:
> I want to take a boost::bind functor and get the type of its arguments.
> I can't find any sort of introspection api documented. I tried using
> mpl but what I came up with doesn't seem to work.
> Is there a way to do this?

It isn't possible in general, because function objects created with bind
are polymorphic.

#include <boost/bind.hpp>

struct F {
    typedef void result_type;
    template<class T>
    void operator()(const T&) const {}

template<class F>
void call(const F& f) {

int main() {
    call(boost::bind(F(), _1));

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at