From 9c2b5c3d7511358919359c4a1c2020fa71631659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=C3=ADel=20Gr=C3=A9tarsson?= Date: Thu, 20 May 2021 08:14:31 +0000 Subject: [PATCH] Add container_type type definition to etl::queue to better match std::queue (#378) * Add container_type type definition to better match std::queue * Add container_type typedef to priority_queue and stack classes to maximize compatibility with the std library --- include/etl/priority_queue.h | 1 + include/etl/queue.h | 5 +++-- include/etl/stack.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/etl/priority_queue.h b/include/etl/priority_queue.h index 5c0cd0cb..b0dd9c37 100644 --- a/include/etl/priority_queue.h +++ b/include/etl/priority_queue.h @@ -418,6 +418,7 @@ namespace etl public: typedef typename TContainer::size_type size_type; + typedef TContainer container_type; static ETL_CONSTANT size_type MAX_SIZE = size_type(SIZE); diff --git a/include/etl/queue.h b/include/etl/queue.h index 4dd12d88..1e5fd07a 100644 --- a/include/etl/queue.h +++ b/include/etl/queue.h @@ -584,7 +584,8 @@ namespace etl public: - typedef typename base_t::size_type size_type; + typedef typename base_t::size_type size_type; + typedef typename etl::aligned_storage::value>::type container_type; ETL_STATIC_ASSERT((SIZE <= etl::integral_limits::max), "Size too large for memory model"); @@ -657,7 +658,7 @@ namespace etl private: /// The uninitialised buffer of T used in the queue. - typename etl::aligned_storage::value>::type buffer[SIZE]; + container_type buffer[SIZE]; }; } diff --git a/include/etl/stack.h b/include/etl/stack.h index 0b2324f3..5cd00fb6 100644 --- a/include/etl/stack.h +++ b/include/etl/stack.h @@ -528,6 +528,7 @@ namespace etl class stack : public etl::istack { public: + typedef typename etl::aligned_storage::value>::type container_type; static ETL_CONSTANT size_t MAX_SIZE = SIZE; @@ -598,7 +599,7 @@ namespace etl private: /// The unintitialised buffer of T used in the stack. - typename etl::aligned_storage::value>::type buffer[SIZE]; + container_type buffer[SIZE]; }; }