Subject: Re: [boost] Suggested change to type_traits/function_traits
From: Barend Gehrels (barend_at_[hidden])
Date: 2010-07-14 05:10:17


Hi,

>
> 2. Have an inner arg struct, templated over an integer indicating
> which argument you want. So instead of:
>
> typedef some_type arg0_type;
> typedef some_other_type arg1_type;
> //...
>
> You would have:
>
> template<int i>
> struct arg
>
> template<>
> struct arg<0>
> {
> typedef some_type type;
> }
>
> template<>
> struct arg<1>
> {
> typedef some_other_type type;
> }
>
> // etc.
>
> I think this would make function_traits more usable for
> metaprogramming. As is, to access the different argN_types you have to
> resort to using boost preprocessor. For backwards compatibility the
> old interface could co-exist with the new one.
>
The Boost function_types library which I'm using since yesterday is more
like this (but not exactly like this) and defining meta-functions and
MPL sequences.
Besides that it has the advantage that it works for both normal
functions and for member functions.

Regards, Barend