Boost logo

Boost Users :

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


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