Skip to content

Instantly share code, notes, and snippets.

View bryanedds's full-sized avatar

Bryan Edds bryanedds

View GitHub Profile
@bryanedds
bryanedds / Alternative.cpp
Last active August 10, 2020 01:56
Abstract Data Types and Alternative Forms of Polymorphism in C++
#include "functional"
#include "iostream"
namespace proj
{
/// Polymorphism in C++ is typically implemented with dynamic dispatch. On the plus side, it's
/// easy to grasp (initially), well-understood, and works retroactively. On the minus side, it
/// sucks you into OOP quagmires too easily and is not terribly efficient. Knowing about other
/// types of polymorphims may lead you to avoid this approach wherever practical. Places where
/// it's practically unavoidable are those that require user-defined subtypes, such as plugins
@bryanedds
bryanedds / Injection.cpp
Last active April 19, 2023 11:52
Abstract Data Types and Dependency Injection in C++
#include "functional"
#include "iostream"
#include "string"
namespace proj
{
/// For background on the discussed subject matter, first see this gist article on Abstract Data
/// Types and Alternative Forms of Polymorphism in C++ - https://gist.github.com/bryanedds/6a8ea281bb4a3d8b559e
/// Dependency injection in C++ is easy, if you do it carefully. The quickest way to do it
@bryanedds
bryanedds / rules.md
Last active January 27, 2016 10:31
Bryan Edds's Moderation Rules

Rule 1: No unprovoked abuse, where abuse is defined as statements intended to belittle someone personally.

As clarification, unintentional belittling is tolerated, since we don't all want to walk on egg-shells. For example, we do not care about 'microaggressions' or 'exclusive speech' or whatever.

Rule 2: If someone is trying to get specific on-topic help, please avoid drowning out the conversation with off-topic stuff.

Otherwise, off-topic stuff is fine.

Rule 3: (Owners only): Owners please monitor Lounge for unwanted questions, then redirect (or bin) them here.

@bryanedds
bryanedds / general_rules.txt
Created January 5, 2016 23:42
Rule's for Bryan's various chat rooms and stuff.
Rule 1: No unprovoked abuse, where abuse is defined as statements intended to belittle someone personally.
As clarification, unintentional belittling is tolerated, since we don't all want to walk on egg-shells. For example, we do not care about'microaggressions' or 'exclusive speech' or whatever.
Rule 2: If someone if trying to get specific on-topic help, please avoid drowning out the conversation with off-topic stuff.
Otherwise, off-topic stuff is fine.
@bryanedds
bryanedds / container.hpp
Last active January 22, 2016 07:33
C++ map, filter, fold
#ifndef xtd_container_hpp
#define xtd_container_hpp
#include <cstddef>
#include <initializer_list>
#include <vector>
#include "prelude.hpp"
template<typename Cr, typename Fn>
@bryanedds
bryanedds / Errors.txt
Created February 13, 2016 01:10
peverify errors in debug build of Prime.exe
C:\Program Files (x86)\Microsoft Visual Studio 14.0>peverify C:\Development\NuGa
meEngine\Prime\Prime\Prime\bin\Debug\Prime.exe
Microsoft (R) .NET Framework PE Verifier. Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.
[IL]: Error: [C:\Development\NuGameEngine\Prime\Prime\Prime\bin\Debug\Prime.exe
: Prime.Observation::observe[a,o,w]][offset 0x00000003] Unable to resolve token.
[HRESULT 0x8007000B] - An attempt was made to load a program with an incorrect
@bryanedds
bryanedds / Vsrl.fs
Last active June 8, 2016 23:03
Visually-Scripted Reactive Language (VSRL) - Prototype
// Nu Game Engine.
// Copyright (C) Bryan Edds, 2012-2016.
namespace Nu
open System
open System.Collections.Generic
open System.Runtime.InteropServices
open OpenTK
open Prime
@bryanedds
bryanedds / Tmap.fs
Last active June 23, 2016 04:07
Transactional map prototype. I consider this one in a class of 'convergence-biased persistent data structures', that is, a persistent data structure biased to perform well only when divergence of it timelines is minimal.
// Prime - A PRIMitivEs code library.
// Copyright (C) Bryan Edds, 2012-2016.
namespace Prime
open System
open System.Collections.Generic
[<AutoOpen>]
module TexprModule =
@bryanedds
bryanedds / Assert.fs
Created July 12, 2016 16:35
There, fuck nunit.
exception AssertionException of string
module Assert =
let isTrue value =
if not value then
raise (AssertionException "Expected true but got false.")
let isFalse value =
if value then
@bryanedds
bryanedds / Assert.fs
Last active July 12, 2016 16:43
There, screw nunit.
exception AssertException of string
module Assert =
let isTrue value =
if not value then
raise (AssertException "Expected true but got false.")
let isFalse value =
if value then