/utl

Chronimal's collection of C++17/20 utility code

Primary LanguageC++MIT LicenseMIT

C++17/20 utility code

A collection of newly refactored utility code I have written for and used in many personal projects over the years.

Utilities

  • RingBuffer<T, N> is a fixed size circular buffer with an STL compliant interface implemented in a single header file. Usage examples and test harnesses are here.

  • TempBuffer<L> is a fixed size buffer typically allocated on the stack with dynamic allocation as fall back implemented in a single header file. Usage examples and test harnesses are here.

  • UniqueBuffer is a fixed size buffer allocating memory by utilizing std::pmr::memory_resource and is implemented in a single header file. Usage examples and test harnesses are here.

  • ScopeGuard is a utility class with a long history. My first implementation was based on Andrei Alexandrescu's excellent book Modern C++ Design and his Loki library. With the advent of C++11 I wrote a simplified version based on a talk again by Andrei. Later, I learned about folly by Facebook and ever since I use their vastly superior version. A copy with all dependencies on folly removed can be found here and the corresponding test harnesses are here.