Skip to content

Instantly share code, notes, and snippets.

#include "tasklist.hpp"
#include <iostream>
#include <string>
template<class T>
T *create_task();
tasklist::storage *delete_task(tasklist::arstorage);
struct a0 : public tasklist::task{
@pointwiseproduct
pointwiseproduct / sample.cpp
Last active November 19, 2016 03:36
要素に自身と同じ型の集合を許容する集合
#include <set>
#include <boost/variant.hpp>
#include <boost/any.hpp>
template<class T>
struct multiplex_less;
template<class T>
class set : public std::set<boost::variant<T, set<T>>, multiplex_less<T>>{
public:
set() = default;
@pointwiseproduct
pointwiseproduct / sample.cpp
Last active November 19, 2016 07:00
OCamlとC++の比較
#include <memory>
#include <list>
#include <tuple>
#include <string>
#include <algorithm>
using namespace std;
struct t{
public:
// em++ -std=c++11 -s NO_EXIT_RUNTIME=1 -s ASYNCIFY=1 -s DISABLE_EXCEPTION_CATCHING=0 trs.cpp --bind -o trs.js -O2
#include <algorithm>
#include <vector>
#include <tuple>
#include <functional>
#include <utility>
#include <memory>
#include <map>
#include <cmath>
// TypeScriptのめんどくさいところ.
class A{
value: number;
// 引数の型が違うコンストラクタを分けて記述できない.
// constructor(){ ... }
// constructor(other: A){ ... }
// 仕方が兄のでvalue?: anyを列挙してコンストラク内部でinstanceofチェックをする.
constructor(_other?: any){
@pointwiseproduct
pointwiseproduct / trs.cpp
Last active August 30, 2016 16:29
Term Rewriting System
#include <algorithm>
#include <vector>
#include <tuple>
#include <functional>
#include <utility>
#include <memory>
#include <map>
#include <boost/coroutine2/all.hpp>
#include <boost/variant.hpp>