From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2007-06-13 19:20:44


"Kirit Sælensminde" <kirit.saelensminde_at_[hidden]> wrote

> I've been playing around with a few functional programming idioms in C++
> using Boost.function and Boost.lambda and was wondering if it was
> possible to fetch out the argument type (i.e. int) from a type like this:
>
> void (*somefunc)( int )

You don't need any libraries for this -- just use partial template
specialization:

template<class T> struct deduce_arg; //not defined

template<class A> struct deduce_arg<void(*)(A0)>
{
    typedef A0 type;
};

Regards,
Arkadiy