Skip to content

Instantly share code, notes, and snippets.

View thierryseegers's full-sized avatar

Thierry Seegers thierryseegers

View GitHub Profile
@thierryseegers
thierryseegers / markov_chain.h
Last active June 12, 2016 05:43
Markov chain implementation, generic on type and n-gram length.
/*
(C) Copyright Thierry Seegers 2016. Distributed under the following license:
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
@thierryseegers
thierryseegers / block_allocate.h
Last active December 3, 2015 17:43
Allocate [n times T]+ in a single block of memory
using memory_block = std::unique_ptr<uint8_t[]>;
namespace detail
{
template<typename T>
std::size_t block_size(T* const, std::size_t const n)
{
return sizeof(T) * n + alignof(T) - 1;
}
@thierryseegers
thierryseegers / event_channel versions demo
Created April 23, 2014 02:32
Demo version of event_channel implemented in C++03/Boost, C++11 and C++14.
Dummy file for the sake of having a good name for this gist.
@thierryseegers
thierryseegers / commands
Last active July 10, 2016 09:52
commands is a single-header C++ framework that reifies the command design pattern. It features macro recording, multi-level undo and serialization.
Dummy file for the sake of having a good name for this gist.