From c1e274bf4c7b6cb656a2f3f6022af98e6f0159d7 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Tue, 24 Dec 2024 14:36:42 +0100 Subject: [PATCH] Add max_item_size() to etl::ipool --- include/etl/ipool.h | 8 ++++++++ test/test_pool.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/include/etl/ipool.h b/include/etl/ipool.h index ce4c317e0..88e03e46f 100644 --- a/include/etl/ipool.h +++ b/include/etl/ipool.h @@ -271,6 +271,14 @@ namespace etl return Max_Size; } + //************************************************************************* + /// Returns the maximum size of an item in the pool. + //************************************************************************* + size_t max_item_size() const + { + return Item_Size; + } + //************************************************************************* /// Returns the maximum number of items in the pool. //************************************************************************* diff --git a/test/test_pool.cpp b/test/test_pool.cpp index 48f2881ab..2866ab1d0 100644 --- a/test/test_pool.cpp +++ b/test/test_pool.cpp @@ -288,6 +288,14 @@ namespace CHECK(pool.max_size() == 4U); } + //************************************************************************* + TEST(test_max_item_size) + { + etl::pool pool; + + CHECK(pool.max_item_size() == sizeof(Test_Data)); + } + //************************************************************************* TEST(test_size) {