Understanding boost mil::apply

Hi,

I need some help understanding the following expression:

typedef mpl::apply<_1, std::vector<int>>::type t3;


As far as I have tested, t3 is equivalent to std::vector<int> so what is the _1 for?

Thanks
Juan
mpl::apply<f, args...> takes its first parameter and invokes it (in MPL sense) with the rest as arguments, meaning, it evaluates to f::apply<args...>::type

the unnamed placeholder _1 is a typedef for arg<1>, a metafunction that returns the 1st of its arguments. _1::apply<A,B,C,D>::type is A

http://www.boost.org/doc/libs/1_61_0/libs/mpl/doc/refmanual/apply.html
http://www.boost.org/doc/libs/1_61_0/libs/mpl/doc/refmanual/placeholders.html
http://www.boost.org/doc/libs/1_61_0/libs/mpl/doc/refmanual/arg.html
Topic archived. No new replies allowed.