Skip to content

Instantly share code, notes, and snippets.

@egtra
egtra / recursive_func_in_lambda.cpp
Created March 9, 2012 17:59 — forked from pseuxdonimo/recursive_func_in_lambda.cpp
C++11のラムダ式で再帰
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
typedef std::function<int (int)> F;
F Fix(std::function<F (F)> f)
{
return [=](int t) {return f(Fix(f))(t);};
@egtra
egtra / result.txt
Created July 31, 2011 06:15 — forked from gfx/result.txt
->> g++4 -Wextra -Wall -DNDEBUG -O3 simple_refcount.cc && ./a.exe
sizeof(String) : 8
sizeof(std::string) : 4
intrusive_ptr<String> 1.107
boost::shared_ptr<string> with make_shared 1.559
boost::shared_ptr<string> with new 1.778
std::shared_ptr<string> with make_shared 1.248
std::shared_ptr<string> with new 1.779
string 0.655