From f0ebf26b6da6034a7ded8ee576b949e96dacdb62 Mon Sep 17 00:00:00 2001 From: rolandreichweinbmw Date: Thu, 26 Dec 2024 14:15:14 +0100 Subject: [PATCH] Add max_item_size() to etl::ipool (#1001) --- 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 ce4c317e..88e03e46 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 48f2881a..2866ab1d 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) {