Boost logo

Boost Users :

Subject: Re: [Boost-users] [FunctionTypes] Getting functor/lambda parameters (VS2012)
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2013-10-12 14:28:18


On 11 October 2013 22:46, Stzpz <newstzpz_at_[hidden]> wrote:
> I am not sure what is lacking in VS2012, but there is some way to overcome
> this problem.
>
> template<class T, int argNo>
> struct FunctorParameterType
> {
> static auto init() -> typename decltype(&T::operator())
> {
> typedef typename decltype(&T::operator()) func_type;
> return func_type();
> }
> typedef typename decltype(FunctorParameterType<T, argNo>::init()) func_type;
> typedef boost::function_types::parameter_types<func_type> parameter_types;
>
> typedef typename boost::mpl::at_c<parameter_types, argNo>::type type;
> };

Nice one, thanks!

I'll give it a try when I need it again.

Best regards,

-- 
Mateusz  Loskot, http://mateusz.loskot.net

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