2008-11-19
■[C++] C++0x ラムダ式で再帰
ネタ元:Visual C++ Team Blog - Stupid Lambda Tricks
VC++10 CTPで確認
#include <iostream> #include <functional> using namespace std; using namespace std::tr1; int main() { function<int(int)> fact = [&fact](int x) { return x == 0 ? 1 : x * fact(x - 1); }; cout << fact(3) << endl; }
動いた−。
トラックバック - http://d.hatena.ne.jp/faith_and_brave/20081119/1227087326
リンク元
- 16 http://d.hatena.ne.jp/
- 9 http://www.google.co.jp/search?hl=ja&client=firefox-a&rls=org.mozilla:ja:official&hs=90O&lr=lang_ja&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=Array+VC++&spell=1
- 8 http://cpp.ring.hatena.ne.jp/
- 7 http://d.hatena.ne.jp/Nagise/
- 7 http://ja.reddit.com/r/ja
- 5 http://a.hatena.ne.jp/uskz/?gid=290138
- 5 http://www.google.co.jp/search?hl=ja&lr=lang_ja&client=firefox-a&rls=org.mozilla:ja-JP-mac:official&hs=i2D&q=NSString&start=10&sa=N
- 5 http://www.google.co.jp/search?sourceid=navclient&aq=t&hl=ja&ie=UTF-8&rlz=1T4ADBF_jaJP278JP279&q=LIVEALIVE+小説
- 5 http://www.google.co.jp/search?sourceid=navclient&hl=ja&ie=UTF-8&rlz=1T4GGIH_jaJP270&q=c+++vector+結合
- 5 http://www.google.com/reader/view/