[c++] lambda递归

/ 3,088评论 / 10534阅读 / 0点赞

lambda表达式

int main() {
    // 声明
    auto fun = []() {
        cout << 123 << endl;
    };
    // 调用
    fun();
    return 0;
}

递归

int hello(int value) {
    if(value < 0) {
        return 0;
    }
    cout << value << endl;
    hello(value - 1);
}

lambda递归

int main() {
    auto fun = [&fun](int value) {
        if(value < 0) { 
             return;
        }
        cout << value << endl;
        // 这里是不行的!!!
        fun(value - 1);
    };
    fun(10);
    return 0;
}

#include <iostream>
#include <functional>
using namespace std;

int main() {
    int i = 10;
    std::function<void()> myfun;
    myfun = [&myfun, &i]() {
        if (i < 0) {
            return;
        }
        cout << i << endl;
        --i;
        myfun();
    };
    myfun();
    return 0;
}
  1. Robertperma说道:

    cytotec buy online usa buy cytotec in usa cytotec pills buy online

  2. I want assembling utile info, this post has got me even more info! .

  3. PatrickHindy说道:

    http://nolvadexbestprice.pro/# where to get nolvadex

  4. Matthewnouts说道:

    cytotec abortion pill: buy cytotec over the counter – purchase cytotec

  5. LewisToite说道:

    https://cytotecbestprice.pro/# buy cytotec online

  6. PatrickHindy说道:

    http://prednisonebestprice.pro/# prednisone online pharmacy

  7. Matthewnouts说道:

    purchase zithromax z-pak: zithromax 500mg price – zithromax over the counter

  8. Robertperma说道:

    buy cytotec online fast delivery cytotec online Abortion pills online

  9. CASINO5588说道:

    After going over a number of the blog articles on your web page, I honestly like your technique of blogging. I bookmarked it to my bookmark site list and will be checking back soon. Please visit my web site as well and let me know your opinion.

  10. NelsonSaIlk说道:

    mexican mail order pharmacies: reputable mexican pharmacies online – buying prescription drugs in mexico

  11. DominicHOr说道:

    best online pharmacies in mexico: mexico drug stores pharmacies – mexican border pharmacies shipping to usa

  12. Slot说道:

    I’m amazed, I must say. Seldom do I come across a blog that’s both educative and entertaining, and without a doubt, you have hit the nail on the head. The problem is something not enough folks are speaking intelligently about. I am very happy that I stumbled across this in my search for something regarding this.

  13. Arnoldscava说道:

    medicine in mexico pharmacies mexican online pharmacies prescription drugs reputable mexican pharmacies online

  14. DominicHOr说道:

    mexico drug stores pharmacies: best online pharmacies in mexico – mexico pharmacies prescription drugs

  15. Casino说道:

    Hi! I simply want to give you a big thumbs up for the great info you’ve got here on this post. I’ll be coming back to your blog for more soon.

  16. Waynetar说道:

    purple pharmacy mexico price list: mexico drug stores pharmacies – purple pharmacy mexico price list

  17. Arnoldscava说道:

    purple pharmacy mexico price list mexican rx online medicine in mexico pharmacies

  18. NelsonSaIlk说道:

    buying prescription drugs in mexico online: buying prescription drugs in mexico online – purple pharmacy mexico price list

  19. Waynetar说道:

    mexican mail order pharmacies: mexican drugstore online – mexican mail order pharmacies

  20. DominicHOr说道:

    mexican pharmaceuticals online: buying prescription drugs in mexico online – reputable mexican pharmacies online

  21. NelsonSaIlk说道:

    medicine in mexico pharmacies: mexican online pharmacies prescription drugs – mexican border pharmacies shipping to usa

  22. Arnoldscava说道:

    mexican rx online medication from mexico pharmacy mexico drug stores pharmacies

  23. site web说道:

    It’s hard to find educated people for this topic, however, you sound like you know what you’re talking about! Thanks

  24. DominicHOr说道:

    mexican pharmaceuticals online: mexican online pharmacies prescription drugs – mexican border pharmacies shipping to usa

  25. Temp mail说道:

    The degree of my admiration for your work is as substantial as your own sentiment. Your visual display is tasteful, and the authored content is stylish. However, you appear apprehensive about the possibility of delivering something that may be viewed as questionable. I believe you’ll be able to rectify this matter efficiently.

  26. Waynetar说道:

    mexico drug stores pharmacies: mexican drugstore online – best online pharmacies in mexico

  27. Arnoldscava说道:

    mexico drug stores pharmacies mexican pharmaceuticals online mexico drug stores pharmacies

  28. NelsonSaIlk说道:

    buying from online mexican pharmacy: mexican border pharmacies shipping to usa – buying from online mexican pharmacy

  29. Waynetar说道:

    mexican pharmaceuticals online: mexican border pharmacies shipping to usa – medicine in mexico pharmacies

  30. blogmedia说道:

    Usually I do not read article on blogs however I would like to say that this writeup very compelled me to take a look at and do so Your writing taste has been amazed me Thanks quite nice post

  31. DominicHOr说道:

    mexico drug stores pharmacies: mexico drug stores pharmacies – mexico drug stores pharmacies

  32. NelsonSaIlk说道:

    mexican drugstore online: mexican rx online – best online pharmacies in mexico

  33. Arnoldscava说道:

    pharmacies in mexico that ship to usa mexican rx online medicine in mexico pharmacies

  34. forbesblogs说道:

    I have read some excellent stuff here Definitely value bookmarking for revisiting I wonder how much effort you put to make the sort of excellent informative website

  35. DominicHOr说道:

    reputable mexican pharmacies online: mexican drugstore online – mexico pharmacies prescription drugs

  36. insightsway说道:

    Thanks I have recently been looking for info about this subject for a while and yours is the greatest I have discovered so far However what in regards to the bottom line Are you certain in regards to the supply

  37. Waynetar说道:

    buying from online mexican pharmacy: mexican mail order pharmacies – mexican rx online

  38. Arnoldscava说道:

    buying prescription drugs in mexico buying prescription drugs in mexico online purple pharmacy mexico price list

  39. Waynetar说道:

    purple pharmacy mexico price list: mexican online pharmacies prescription drugs – mexican pharmaceuticals online

  40. NelsonSaIlk说道:

    purple pharmacy mexico price list: mexican rx online – mexico drug stores pharmacies

  41. DominicHOr说道:

    mexico drug stores pharmacies: pharmacies in mexico that ship to usa – mexican rx online

  42. Arnoldscava说道:

    purple pharmacy mexico price list mexican drugstore online buying prescription drugs in mexico online

  43. NelsonSaIlk说道:

    purple pharmacy mexico price list: buying prescription drugs in mexico online – п»їbest mexican online pharmacies

  44. DominicHOr说道:

    medicine in mexico pharmacies: purple pharmacy mexico price list – buying prescription drugs in mexico

  45. Arnoldscava说道:

    mexican rx online mexico drug stores pharmacies п»їbest mexican online pharmacies

  46. Waynetar说道:

    purple pharmacy mexico price list: buying prescription drugs in mexico online – mexican rx online

  47. DominicHOr说道:

    buying from online mexican pharmacy: mexican rx online – п»їbest mexican online pharmacies

  48. Waynetar说道:

    п»їbest mexican online pharmacies: pharmacies in mexico that ship to usa – mexico drug stores pharmacies

  49. NelsonSaIlk说道:

    п»їbest mexican online pharmacies: best online pharmacies in mexico – best online pharmacies in mexico

  50. Arnoldscava说道:

    purple pharmacy mexico price list medication from mexico pharmacy buying prescription drugs in mexico online

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注