「C++0x」 std::lambda

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

int main(){
	auto A = [](function<void ()> rhs)->int
	{
		cout << "lambda str!" << endl;
		// 引数で取った返り値なし:void,引数なし:()なfunctionを実行
		rhs();
		return 3;
	};
	// void ()なラムダ式を、上のラムダ式に渡す
	A([](){ cout << "double!!" << endl;});

	return 0;
}

実行結果:

lambda str!
double!!

色々できるんだなぁ・・・。