29#ifndef ETL_VARIANT_POOL_INCLUDED
30#define ETL_VARIANT_POOL_INCLUDED
35#include "static_assert.h"
42#if ETL_USING_CPP11 && !defined(ETL_VARIANT_POOL_FORCE_CPP03_IMPLEMENTATION)
44 template <
size_t MAX_SIZE_,
typename... Ts>
45 class variant_pool :
public etl::generic_pool<etl::largest<Ts...>::size, etl::largest<Ts...>::alignment, MAX_SIZE_>
49 typedef etl::generic_pool<etl::largest<Ts...>
::size, etl::largest<Ts...>::alignment, MAX_SIZE_> base_t;
51 static const size_t MAX_SIZE = MAX_SIZE_;
61 template <
typename T,
typename... Args>
64 ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value),
"Unsupported type");
66 return base_t::template
create<T>(etl::forward<Args>(args)...);
75 ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value || etl::is_base_of_any<T, Ts...>::value),
"Invalid type");
95 template <
typename... Ts>
106 : base_t(buffer,
size)
113 template <
typename T,
typename... Args>
116 ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value),
"Unsupported type");
118 return base_t::template
create<T>(etl::forward<Args>(args)...);
124 template <
typename T>
127 ETL_STATIC_ASSERT((etl::is_one_of<T, Ts...>::value || etl::is_base_of_any<T, Ts...>::value),
"Invalid type");
137 return base_t::max_size();
146 #include "private/variant_pool_cpp03.h"
Definition variant_pool.h:201
T * create()
Creates the object. Default constructor.
Definition variant_pool.h:220
void destroy(const T *const p)
Destroys the object.
Definition variant_pool.h:287
variant_pool_ext(typename base_t::element *buffer, size_t size)
Default constructor.
Definition variant_pool.h:210
size_t max_size() const
Returns the maximum number of items in the variant_pool.
Definition variant_pool.h:313
Definition variant_pool.h:56
size_t max_size() const
Returns the maximum number of items in the variant_pool.
Definition variant_pool.h:170
void destroy(const T *const p)
Destroys the object.
Definition variant_pool.h:144
T * create()
Creates the object. Default constructor.
Definition variant_pool.h:77
variant_pool()
Default constructor.
Definition variant_pool.h:68
Definition variant_pool_cpp03.h:200
size_t size() const
Returns the number of allocated items in the pool.
Definition ipool.h:522
Definition generic_pool.h:216
bitset_ext
Definition absolute.h:40