Skip to content

Instantly share code, notes, and snippets.

#ifndef DI_HPP
#define DI_HPP
#include <type_traits>
#include <utility>
#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/aux_/yes_no.hpp>
#define CTOR(T, ...) \
#ifndef LOGGER_HPP
#define LOGGER_HPP
#include <iostream>
#include <sstream>
#include <boost/none_t.hpp>
enum log_level {
error = 1,
warn = 2,
#ifndef SDL_MSM_HPP
#define SDL_MSM_HPP
#include <type_traits>
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/transform.hpp>
#include <boost/mpl/pop_front.hpp>
#include <boost/mpl/front.hpp>
#include <boost/mpl/empty.hpp>
#define BOOST_MPL_LIMIT_VECTOR_SIZE 70
#if (BOOST_MPL_LIMIT_VECTOR_SIZE <= 50)
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#include <boost/mpl/vector.hpp>
#else
#include <boost/preprocessor/iterate.hpp>
#include <boost/mpl/vector/vector50.hpp>
namespace boost {
@kris-jusiak
kris-jusiak / get_boost.sh
Last active August 29, 2015 14:02
get boost
#!/bin/bash
git clone --quiet --depth=1 --single-branch https://github.com/boostorg/boost.git
cd boost
git submodule update --init --quiet -- tools/build tools/inspect libs/wave `echo $@ | tr ' ' '\n' | xargs -i% echo libs/% | xargs`
#ifndef TEST_HPP
#define TEST_HPP
#include <cassert>
#define expect(...) assert((__VA_ARGS__))
#define expect_eq(t1, t2) assert((t1 == t2))
#define expect_neq(t1, t2) assert((t1 != t2))
struct test {
@kris-jusiak
kris-jusiak / hana_error.cpp
Created June 18, 2015 10:55
Hana - Compilation Error -> MonadPlus not satisfied
#include <type_traits>
#include <boost/hana.hpp>
namespace hana = boost::hana;
template<class>
struct yet { };
template<typename T>
struct some_magic {
@kris-jusiak
kris-jusiak / hana_map.cpp
Created June 18, 2015 10:56
Hana - Map -> Get key
#include <boost/hana.hpp>
namespace hana = boost::hana;
using namespace hana::literals;
constexpr auto m = hana::make_map(
hana::make_pair(1_c, 1_c)
, hana::make_pair(2_c, 2_c)
, hana::make_pair(3_c, 3_c)
@kris-jusiak
kris-jusiak / tricks_map.cpp
Created June 18, 2015 10:57
Tricks Map -> Get key
#include <type_traits>
template<class, class> struct pair { };
template<class... Ts>
struct map : Ts... { };
template<class T>
struct no_decay { using type = T; };
#!/bin/bash
pushd .
dir=$(pwd)
cd $2
$1 --preserve-paths --relative-only $(find $dir/$3 -iname "*.gcda") >/dev/null
echo "#!/usr/bin/python
import json,sys,codecs