[c++] lambda递归

/ 3,088评论 / 10528阅读 / 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. DominicHOr说道:

    mexico pharmacies prescription drugs: buying from online mexican pharmacy – buying prescription drugs in mexico online

  2. NelsonSaIlk说道:

    reputable mexican pharmacies online: medicine in mexico pharmacies – mexico drug stores pharmacies

  3. blogmedia说道:

    I was recommended this website by my cousin I am not sure whether this post is written by him as nobody else know such detailed about my trouble You are amazing Thanks

  4. Vitazen Keto Gummies very informative articles or reviews at this time.

  5. Arnoldscava说道:

    mexico drug stores pharmacies medicine in mexico pharmacies mexican drugstore online

  6. magzineusa说道:

    Fantastic site Lots of helpful information here I am sending it to some friends ans additionally sharing in delicious And of course thanks for your effort

  7. Waynetar说道:

    mexico pharmacies prescription drugs: pharmacies in mexico that ship to usa – buying prescription drugs in mexico

  8. DominicHOr说道:

    buying prescription drugs in mexico online: buying prescription drugs in mexico – pharmacies in mexico that ship to usa

  9. Waynetar说道:

    mexico drug stores pharmacies: mexican rx online – mexican mail order pharmacies

  10. Arnoldscava说道:

    mexico pharmacies prescription drugs mexican border pharmacies shipping to usa mexico pharmacies prescription drugs

  11. NelsonSaIlk说道:

    mexican drugstore online: purple pharmacy mexico price list – medication from mexico pharmacy

  12. NelsonSaIlk说道:

    buying prescription drugs in mexico: mexican rx online – medicine in mexico pharmacies

  13. Exchange-traded funds (ETFs) began to feature commodities in 2003.

  14. Arnoldscava说道:

    buying prescription drugs in mexico online mexico pharmacy mexico drug stores pharmacies

  15. However, some of the folks I have referred to them have had some unsettling issues with EZ Trader.

  16. Waynetar说道:

    mexican online pharmacies prescription drugs: buying from online mexican pharmacy – buying from online mexican pharmacy

  17. DominicHOr说道:

    medication from mexico pharmacy: mexico drug stores pharmacies – mexican pharmaceuticals online

  18. Waynetar说道:

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

  19. Arnoldscava说道:

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

  20. NelsonSaIlk说道:

    mexico pharmacies prescription drugs: mexican mail order pharmacies – mexican drugstore online

  21. DominicHOr说道:

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

  22. NelsonSaIlk说道:

    mexico drug stores pharmacies: mexico drug stores pharmacies – mexico pharmacies prescription drugs

  23. Arnoldscava说道:

    mexican pharmacy buying prescription drugs in mexico online mexico drug stores pharmacies

  24. Waynetar说道:

    mexico drug stores pharmacies: reputable mexican pharmacies online – mexican pharmaceuticals online

  25. DominicHOr说道:

    reputable mexican pharmacies online: medication from mexico pharmacy – purple pharmacy mexico price list

  26. Waynetar说道:

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

  27. Arnoldscava说道:

    buying prescription drugs in mexico online best online pharmacies in mexico mexican pharmaceuticals online

  28. DominicHOr说道:

    pharmacies in mexico that ship to usa: mexican mail order pharmacies – reputable mexican pharmacies online

  29. NelsonSaIlk说道:

    pharmacies in mexico that ship to usa: mexican pharmaceuticals online – mexico pharmacies prescription drugs

  30. NelsonSaIlk说道:

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

  31. Arnoldscava说道:

    mexico drug stores pharmacies mexican pharmaceuticals online mexican rx online

  32. Waynetar说道:

    reputable mexican pharmacies online: п»їbest mexican online pharmacies – reputable mexican pharmacies online

  33. DominicHOr说道:

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

  34. Waynetar说道:

    mexican drugstore online: reputable mexican pharmacies online – mexican pharmaceuticals online

  35. Arnoldscava说道:

    buying prescription drugs in mexico mexican pharmaceuticals online mexico pharmacy

  36. DominicHOr说道:

    mexico drug stores pharmacies: pharmacies in mexico that ship to usa – medication from mexico pharmacy

  37. NelsonSaIlk说道:

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

  38. NelsonSaIlk说道:

    mexican border pharmacies shipping to usa: purple pharmacy mexico price list – mexican drugstore online

  39. Arnoldscava说道:

    buying from online mexican pharmacy mexican pharmaceuticals online purple pharmacy mexico price list

  40. Waynetar说道:

    medication from mexico pharmacy: mexico drug stores pharmacies – medication from mexico pharmacy

  41. DominicHOr说道:

    mexican online pharmacies prescription drugs: mexico drug stores pharmacies – buying prescription drugs in mexico

  42. Waynetar说道:

    mexican pharmaceuticals online: mexican mail order pharmacies – mexican online pharmacies prescription drugs

  43. Arnoldscava说道:

    purple pharmacy mexico price list mexico drug stores pharmacies buying prescription drugs in mexico

  44. DominicHOr说道:

    mexican mail order pharmacies: mexican border pharmacies shipping to usa – medicine in mexico pharmacies

  45. NelsonSaIlk说道:

    mexico pharmacies prescription drugs: buying prescription drugs in mexico – mexico pharmacies prescription drugs

  46. NelsonSaIlk说道:

    mexico drug stores pharmacies: purple pharmacy mexico price list – best online pharmacies in mexico

  47. I have been surfing online more than 3 hours today yet I never found any interesting article like yours It is pretty worth enough for me In my opinion if all web owners and bloggers made good content as you did the web will be much more useful than ever before

  48. Film Bokeh说道:

    I wanted to take a moment to commend you on the outstanding quality of your blog. Your dedication to excellence is evident in every aspect of your writing. Truly impressive!

  49. Arnoldscava说道:

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

  50. What i do not understood is in truth how you are not actually a lot more smartlyliked than you may be now You are very intelligent You realize therefore significantly in the case of this topic produced me individually imagine it from numerous numerous angles Its like men and women dont seem to be fascinated until it is one thing to do with Woman gaga Your own stuffs nice All the time care for it up

发表回复

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