Skip to content

Instantly share code, notes, and snippets.

@Fuyutsubaki
Fuyutsubaki / Fact.h
Created August 5, 2013 15:34
prologの事実みたいなことをC++でもしたい
#pragma once
#include<tuple>
#include<vector>
namespace proloog
{
class None{};
class Var{};
template<class... X>
@Fuyutsubaki
Fuyutsubaki / tuple_foreach.hpp
Created September 27, 2013 16:37
for each of tuple
#pragma once
#include<tuple>
namespace deteil{
template<class Tuple,class Visitor>
class _tuple_foreach
{
public:
void operator()(Tuple & tuple, Visitor& visitor)
@Fuyutsubaki
Fuyutsubaki / memfunc2class
Last active December 31, 2015 20:09
使用するメンバ関数をクラスに通知する(ようにみせかける)方法
#include<iostream>
#include<vector>
#include<string>
//VSでのみ動作を確認
template<class T>
class Piyo
{
public:
void print()
{
@Fuyutsubaki
Fuyutsubaki / DebugTimer.hpp
Created December 27, 2013 06:44
デバックタイマー。呼び出された回数と時間を教えてくれる
#pragma once
#include<chrono>
#include<string>
#include<list>
class DebugTimer
{
struct Data
{
Data(const std::string&id)
@Fuyutsubaki
Fuyutsubaki / Type2ValueMap.hpp
Created January 12, 2014 07:46
型から値をだすmap Type to Value map on C++
#include<boost\any.hpp>
#include<unordered_map>
#include<typeindex>
#include<iostream>
#include<string>
class Type2ValueMap
{
public:
template<class T>
@Fuyutsubaki
Fuyutsubaki / unique_ptr_Holder.hpp
Created January 17, 2014 16:03
Mini Garbage Collection on C++ 小さなガベージコレクション
#pragma once
#include<memory>
#include<unordered_map>
#include<initializer_list>
#include<type_traits>
/*
**sample**
struct A
@Fuyutsubaki
Fuyutsubaki / Generic_lambda_If.hpp
Last active January 3, 2016 23:39
ジェネリックラムダ2つを受け取りどちらか1つを返す関数型言語のif式っぽいの
//sample http://txt-txt.hateblo.jp/entry/2014/01/21/180633
#include<boost\variant\variant.hpp>
#include<type_traits>
#include<utility>
template<class F1,class F2>
class BiGenLambda
{
template<class F>
@Fuyutsubaki
Fuyutsubaki / fuse_cast.hpp
Created February 20, 2014 10:30
[std::function<R(Args...)>] → [std::function<R(std::tuple<Args...>)]
#include<functional>
#include<tuple>
namespace tupleple
{
namespace deteil{
template<size_t ...R>
struct size_t_List{};
template<size_t N>
@Fuyutsubaki
Fuyutsubaki / gist:6803bd43553db89d0d32
Created May 10, 2014 04:20
無名構造体もどき
#include<iostream>
#include<string>
namespace iod
{
template<class...>
struct iod_tuple{};
@Fuyutsubaki
Fuyutsubaki / PPL.hpp
Last active August 29, 2015 14:01
PARAMETER_PACK helper
#ifndef PARAMETER_PACK_LIBRARY_HPP_140521
#define PARAMETER_PACK_LIBRARY_HPP_140521
#include<type_traits>
#include<tuple>
namespace ppl
{
namespace deteil
{
template<size_t ...Idxs>
struct List{};