Skip to content

Instantly share code, notes, and snippets.

View gapspt's full-sized avatar

Jorge Galvao gapspt

  • Duck Games
  • Lisbon
View GitHub Profile
@gapspt
gapspt / ObjectPool.hpp
Created September 14, 2025 19:30
Generic object pool implementation in C++ ( Draft only, untested, might contain errors!)
// Draft only, untested, might contain errors!!!
// Note: spin-lock implementation taken from https://en.cppreference.com/w/cpp/atomic/atomic_flag.html
#include <atomic>
#include <vector>
template <class T> class ObjectPool {
public:
std::function<T*()> factory;