?????????fold_s???????push_back::apply??????push_back??????????????б????????????????????????????????????_1??_2?λ??????????????????boost mpl??????????????????±???????????c++11??????
#ifndef HI_MPL_PLACEHOLDERS_H_INCLUDED
#define HI_MPL_PLACEHOLDERS_H_INCLUDED
//////////////////////////////////////////////////////////////////////
namespace hi { namespace mpl {
//surport palceholders is too painful
namespace placeholders
{
namespace helper
{
template<typename... TList> struct arglist { };
typedef arglist<> nullargs;
template<unsigned int N?? typename... TList> struct at;
template<unsigned int N?? typename T?? typename... TList>
struct at< N?? arglist<T?? TList...> >
{
typedef typename at< N - 1?? arglist<TList...> >::type type;
};
template<typename T?? typename... TList>
struct at< 0?? arglist<T?? TList...> >
{
typedef T type;
};
} // end of placeholders::helper
template<int n> struct Arg
{
template<typename ... TList>
struct apply
{
using type = typename helper::at<n - 1?? helper::arglist<TList...> >::type;
};
private:
};
using _1 = Arg<1>;
using _2 = Arg<2>;
using _3 = Arg<3>;
using _4 = Arg<4>;
} // end of placeholders
}
}
#endif
?????????_1::apply<int?? char?? float>::type?int??  _2::apply<int?? char?? float>::type?char??
?????????????arglist???0??????????????Arg???1??????????
???????????????push_back<_1?? _2>????
template<>
struct push_back< _1?? _2 >
{
template<typename... TList>
struct apply
{
using type = typename push_back<
typename _1::apply<TList...>::type??
typename _2::apply<TList...>::type>::type;
};
};
????fold_s???????????????????push_back????????????λ??????????????????????????????????????????????_1?? _2?λ??????????????
?????????????????????????_1??_2???????????λ??????????μ??????
template<>
struct push_back< _2?? _1 >
{
template<typename... TList>
struct apply
{
using type = typename push_back<
typename _2::apply<TList...>::type??
typename _1::apply<TList...>::type>::type;
};
};
??????????????????fold_s????????????????????push_back??????????λ?????_2λ??push_back??????????????????ú????????????????????
??????????????????push_back<_1??_2>??push_back<_2??_1>??2??????????????????????????????????????????????????