This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A 2D/3D collision grid. MIT licensed | |
// - rlyeh, 2012 | |
#pragma once | |
#include <map> | |
#include <set> | |
#include <cassert> | |
#include <tuple> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <map> // Component-entity system in 16 lines of C++11. 2013 rlyeh, MIT licensed | |
#include <set> // Code fragment from kult engine - https://github.com/r-lyeh/kult | |
enum {JOIN,MERGE,EXCLUDE};using set=std::set<unsigned>;template<typename T> set&system(){ | |
static set entities;return entities;}template<typename T,int MODE>set subsystem(const set | |
&B){set newset;const set&A=system<T>();if(MODE==MERGE){newset=B;for(auto&id:A)newset.ins\ | |
ert(id);}else if(MODE==EXCLUDE){newset=B;for(auto&id:A)newset.erase(id);}else if(A.size() | |
<B.size()){for(auto&id:A)if(B.find(id)!=B.end())newset.insert(id);}else{for(auto&id:B)if( | |
A.find(id)!=A.end())newset.insert(id);}return newset;}template<typename T>std::map<unsig\ | |
ned,T>&components(){static std::map<unsigned,T>objects;return objects;}template<typename\ | |
T>bool has(unsigned id){return components<T>().find(id)!=components<T>().end();}templat\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define USE_ROBIN_HOOD_HASH 1 | |
#define USE_SEPARATE_HASH_ARRAY 1 | |
template<class Key, class Value> | |
class hash_table | |
{ | |
static const int INITIAL_SIZE = 256; | |
static const int LOAD_FACTOR_PERCENT = 90; | |
struct elem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [ref] http://en.wikipedia.org/wiki/Splay_tree | |
#include <functional> | |
#ifndef SPLAY_TREE | |
#define SPLAY_TREE | |
template< typename T, typename Comp = std::less< T > > | |
class splay_tree { | |
private: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*(utf8) | |
1€ Filter, template-compliant version | |
Jonathan Aceituno <[email protected]> | |
25/04/14: fixed bug with last_time_ never updated on line 40 | |
For details, see http://www.lifl.fr/~casiez/1euro | |
*/ | |
#include <cmath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "License": Public Domain | |
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like. | |
#ifndef PORTABLE_ENDIAN_H__ | |
#define PORTABLE_ENDIAN_H__ | |
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__) | |
# define __WINDOWS__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simple every() function | |
// - rlyeh. mit licensed | |
// @todo: during, in, when, | |
#pragma once | |
#include <map> | |
#ifdef EVERY_USE_OMP | |
#include <omp.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// when/unless go/unless keywords | |
// - rlyeh | |
#include <functional> | |
#include <iostream> | |
#define when(...) for( std::function<void()> fn; !fn && (__VA_ARGS__ +0); fn() ) fn = [&] | |
#define unless(...) , !(__VA_ARGS__) ? fn : fn = [&] | |
#define go when(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scheme Interpreter in 90 lines of C++ (not counting lines after the first 90). | |
// Inspired by Peter Norvig's Lis.py. | |
// Made by Anthony C. Hay in 2010. See http://howtowriteaprogram.blogspot.co.uk/ | |
// This is free and unencumbered public domain software, see http://unlicense.org/ | |
// This code is known to have faults. E.g. it leaks memory. Use at your own risk. | |
#include <iostream> | |
#include <sstream> | |
#include <string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem 'cos I always forget how to do it | |
boostrap.bat | |
.\bjam2 runtime-link=static --with-serialization --toolset=msvc-11 && :: vs2012 | |
.\bjam2 runtime-link=static --with-serialization --toolset=msvc-12.0 && :: vs2013, also: architecture=x86 address-model=64 | |
rem also, extracting a lib: | |
bjam tools\bcp | |
dist\bin\bcp.exe algorithm/string.hpp [outdir] |
OlderNewer