A collection of basic/generally desirable code I use across multiple C++ projects.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

3.0 KiB

This is a library of C++ code which I use as a standard library wrapper, supplement, and in some cases, replacement.

If you want to use it, you can add all of the source files to your source tree, configure the #define's in config.h to suit your needs, and it should just work.


Features:

  • Stack, Scratch, and Block-based allocators as well as memory-leak checking mechanism and OS allocator wrappers in alloc.h/.cpp

  • Heap-friendly String type, including format strings and StringBuffers/Builders, as well as <string.h> function replacements as static methods in single-header string.h

  • Instrusive serialization mechanism in serialize.h/.cpp for complex types and primitives (no reflection though)

  • A few hash functions, HashTable and CacheTable (hash table that can forget its keys) implementations in table.hpp

  • A dynamic/growing array implementation in array.hpp

  • Common file operations, <stdio> wrapper in file.h/.cpp

  • Process signal handlers in signal-handler.h (define what happens when your process gets sent a SIGINT signal, etc)

  • stdout / printf wrapper in print.h/.cpp for programmer ergonomics + making it so if you #include <stdio.h> in your program, it will be just in these files.

And some more stuff that is TODO:

  • cpuid x86 instruction wrapper

  • glm replacement - vector, matrix, and quaternion types and some common operations involving them

Licenses & Other Code

fast_float

Our serialization code uses fast_float library by Daniel Lemire et al, provided simultaneously under the Apache License, Version 2.0, the MIT license and/or the BOOST license. The fast_float library itself uses code originally published the Apache 2.0 license.

sse_mathfun.h

The sin, cos, exp, and log replacements used by this library are provided by a single-header library written by Julien Pommier under the zlib license:

Copyright (C) 2007  Julien Pommier

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

  (this is the zlib license)