C++11???boost??λ??placeholder
???????????? ???????[ 2014/11/3 11:36:47 ] ????????C++ NET ??
??????????meta programming??fold?????????????????λ??????????????fold??transform op????????????????ò?????д??????????????????????????????????????????????????????????????fold???????м??Σ????????λ?????????????????????
????????????????
????template<typename TList?? typename Init?? class TransformOp>
????struct fold_s {};
?????????????????push_back????????????fold_s?У??????????????TList?????????????????push_back???磺
????using type = fold_s<typelist<int?? float?? char>?? nullist?? push_back>::type;
???????????push_back???????????????????????push_back<somelist?? t>???????????????????????????????????δ???
??????????????д??????
????struct push_back_wrap
????{
????template<typename TList?? typename T>
????struct apply
????{
????using type = typename mpl::push_back<TList?? T>::type;
????};
????};
????????fold_s??????apply??
????template<typename TList?? typename Init?? class TransformOp>
????struct fold_s
????{
????using sometype = typename TransformOp::apply<TList?? T>::type;
????};
????using type = fold_s<typelist<int?? float?? char>?? nullist?? push_back_wrap>::type;
???????????????????????????????????????push_back_wrap?е??????apply?????push_back_wrap????????????????????????fold_s???????apply????????????meta programming?????lambada?????????????????????????lambda??????????????apply???????????????????????c++ mpl????????????С????????????ɡ?
?????????????????λ????????????????濪?no zuo no die?????ɡ????????Щ???????????flod_s????д???????????????flod_s???????push_back???????push_back??????ü?Щ???????????????????push_back????????
????fold< vector<int?? float?? char>?? vector<>?? push_back<_1?? _2> >::type;
????????_1??_2???λ?????push_back<_1?? _2>??????????????????????_1?? _2???????????????з???vector<>??int??????λ?????????????????λ?á?
?????????????????????????????????????????????push_back?????????????????????????????????????:
????struct push_back<...>
????{
????struct apply
????{
????type...
????};
????};
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11