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.
 
 
 
Nick Hayashi 530f85cf12 wip 2 years ago
README.md wip 2 years ago
alloc.cpp wip 2 years ago
alloc.h wip 2 years ago
array.hpp wip 2 years ago
config.h wip 2 years ago
cpuid.cpp wip 2 years ago
cpuid.h wip 2 years ago
file.cpp wip 2 years ago
file.h wip 2 years ago
print.cpp wip 2 years ago
print.h wip 2 years ago
serialize.cpp wip 2 years ago
serialize.h wip 2 years ago
signal-handler.h wip 2 years ago
sse_mathfun.h wip 2 years ago
string.h wip 2 years ago
table.hpp wip 2 years ago
types.h wip 2 years ago
util.h wip 2 years ago

README.md

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.

The exceptions are the files config.h and types.h which are required by every other file.

  • 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

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)