WSTL — Personal STL

Project Type: Personal Project
Languages Used: Modern C++
Roles: Developer
WSTL logo

About

WSTL is a custom Standard Template Library written in modern C++. Its purpose is to implement better solutions for my own projects — it includes data structures, smart pointers, and allocators tailored for games and simulations, and is designed to slot directly into my custom engine (WCGE).

Roles

Developer

As the only developer, I'm responsible for the making of everything.

Modules

The largest module, and the reason the library exists. Every container is built directly on the WSTL allocator and types — no STL fallbacks — so behaviour stays predictable across platforms and inside arenas. They split across five fronts:

  • Lists & arraysArray, Vector, List (doubly linked), SList (singly linked), Deque, BitSet
  • Keyed lookupMap and Set on a self-balancing red-black tree, HashMap with open addressing and a MurmurHash3 backbone
  • Stacks & queuesStack, Queue, and PriorityQueue (sitting on a BinaryHeap)
  • Stack-allocatedFixedVector for bounded, zero-heap buffers when allocation cost matters
  • GluePair, the value type returned and stored across every keyed container
auto nums = WSTL::Vector<int>{ 1, 2, 3 };
nums.PushBack(4);
nums.PopBack();

WSTL::HashMap<WSTL::string, int> scores;
scores.Insert("andre", 42);

WSTL::FixedVector<int, 16> onStack; // no heap

An aligned Allocator with allocate/construct/destruct/deallocate helpers, free Destruct/Free/FreeArray utilities that respect trivial types, and the three smart-pointer flavours: UniquePointer, SharedPointer, and WeakPointer, with MakeUnique and MakeShared factories.

auto p = WSTL::MakeUnique<Player>("Gaby");
auto s = WSTL::MakeShared<World>();
WSTL::WeakPointer<World> w = s;

Cross-cutting helpers: Optional, type-erased Any, a TypeTraits header, a generic Swap, and a free MurmurHash3 Hash(data, length). HashMap pairs this with a HasCustomHash SFINAE check, letting any type with a Hash() method opt in without specialising a template.

struct Id { int v; WSTL::UI32 Hash() const { return v; } };
static_assert(WSTL::HasCustomHash<Id>::value);

WSTL::Optional<int> maybe(42);
if (maybe.HasValue()) { /* ... */ }

Foundational primitives in Types.hpp the rest of the library is built on: Size and PtrDiff, fixed-width unsigned integers (UI8/UI16/UI32/UI64), Bit and Byte, plus a lowercase string alias for std::string.

Source Code