From 6959a83b7d7e6a272cfd626fa3799a875460f5ea Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Wed, 30 Sep 2026 15:08:18 +0200 Subject: kstd: add ring_buffer include --- libs/kstd/kstd/ring_buffer.hpp | 20 ++++++++++++++++++++ libs/kstd/kstd/ring_buffer.tests.cpp | 17 +++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 libs/kstd/kstd/ring_buffer.hpp create mode 100644 libs/kstd/kstd/ring_buffer.tests.cpp (limited to 'libs/kstd') diff --git a/libs/kstd/kstd/ring_buffer.hpp b/libs/kstd/kstd/ring_buffer.hpp new file mode 100644 index 00000000..0ceb634d --- /dev/null +++ b/libs/kstd/kstd/ring_buffer.hpp @@ -0,0 +1,20 @@ +#ifndef KSTD_RING_BUFFER_HPP +#define KSTD_RING_BUFFER_HPP + +#include + +namespace kstd +{ + + //! A fixed-size buffer that will overwrite elements in an LRU manner when full. + //! + //! @tparam ValueType The type of the values contained in this ring buffer. + //! @tparam Capacity The maximum number of elements this ring buffer can hold. + template + struct ring_buffer + { + }; + +} // namespace kstd + +#endif \ No newline at end of file diff --git a/libs/kstd/kstd/ring_buffer.tests.cpp b/libs/kstd/kstd/ring_buffer.tests.cpp new file mode 100644 index 00000000..3608d5ce --- /dev/null +++ b/libs/kstd/kstd/ring_buffer.tests.cpp @@ -0,0 +1,17 @@ +#include + +#include + +#include + +SCENARIO("Ring Buffer initialization and construction", "[ring_buffer]") +{ + GIVEN("An empty context") + { + WHEN("constructing by default") + { + auto buffer = kstd::ring_buffer{}; + std::ignore = buffer; + } + } +} \ No newline at end of file -- cgit v1.2.3