// snippets

Snippets

snippets 29 Jul 2024 5 min read

CRTP mixin examples

Ready-to-use CRTP mixins: logging, enable/disable toggle, singleton, comparable, printable. Drop into any class to add behaviour without virtual dispatch.

#crtp#mixins#templates#patterns#c++
snippets 08 Jul 2024 5 min read

Object pool allocator

A type-safe, fixed-capacity object pool for embedded and real-time systems. O(1) allocation and deallocation, no heap fragmentation, compatible with unique_ptr.

#allocators#embedded#performance#memory#patterns
snippets 06 May 2024 5 min read

Thread-safe singleton โ€” C++11 and beyond

The only correct singleton implementation in C++11. Why double-checked locking was broken before C++11, why it works now, and when to avoid singletons entirely.

#singleton#concurrency#c++11#patterns
snippets 25 Mar 2024 5 min read

Ring buffer โ€” embedded-safe, templated

A power-of-two ring buffer with no dynamic allocation, safe for use between an ISR and a task. Full implementation you can drop into any project.

#ring-buffer#embedded#data-structures#concurrency