Skip to content

Instantly share code, notes, and snippets.

View sjgriffiths's full-sized avatar

Sam J. Griffiths sjgriffiths

View GitHub Profile
@sjgriffiths
sjgriffiths / DESLinkedList.h
Created January 7, 2018 20:11
Double-ended singly-linked list (C++)
/**
DESLinkedList.h
Implements a class template of a double-ended
(front-and-end-pointered) singly-linked list.
@author Sam Griffiths
www.computist.xyz
*/
#pragma once
@sjgriffiths
sjgriffiths / Queue.h
Created January 7, 2018 20:13
Queue and stack based on linked list (C++)
/**
Queue.h
Implements a class template of a queue
abstract data type.
@author Sam Griffiths
www.computist.xyz
*/
#pragma once
@sjgriffiths
sjgriffiths / Entity.cpp
Last active January 10, 2018 02:10
Primitive game entity (C++)
/**
Entity.cpp
Implements the Entity class, representing
an object within the game engine.
@author Sam Griffiths
www.computist.xyz
*/
@sjgriffiths
sjgriffiths / EntityManager.cpp
Last active January 10, 2018 02:35
Game entity manager (C++)
/**
EntityManager.cpp
Implements the EntityManager class, representing
a collection of Entities responsible for their
instantiation.
@author Sam Griffiths
www.computist.xyz
*/
@sjgriffiths
sjgriffiths / SparseSet.h
Last active July 9, 2024 15:52
Sparse set (C++)
/**
SparseSet.h
Implements a class template of a sparse
set of unsigned integers.
@author Sam Griffiths
www.computist.xyz
*/
#pragma once
@sjgriffiths
sjgriffiths / timeFunc.cpp
Created July 12, 2018 13:36
Simple function timer (C++)
//Times a given function call, plus arguments, in seconds
//Change to Args& if reference passing is required
template <typename F, typename... Args>
double timeFunc(F func, Args... args)
{
using clock = std::chrono::high_resolution_clock;
auto t0 = clock::now();
func(args...);
auto t1 = clock::now();