にゃははー

はへらー

2010-05-28から1日間の記事一覧

lambdaとの格闘(上手投げ)

C++

ふと考えた。c++0xのlambdaってfunctorに展開されるんだからthrow出来るのではないか。書いてみた。 #include <iostream> #include <string> #include <functional> using namespace std; auto except_func( void ) -> void { throw []( void ) -> string { return "exception"; }; } auto </functional></string></iostream>…