A base class for a generic internal fixed size stack and vector.
More...
#include <tpie/internal_stack_vector_base.h>
Inherits tpie::linear_memory_base< child_t >.
|
| static double | memory_coefficient () |
| | Return the memory coefficient of the structure. More...
|
| |
| static double | memory_overhead () |
| | Return the memory overhead of the structure. More...
|
| |
| static constexpr memory_size_type | memory_usage (memory_size_type size) noexcept |
| | Return the number of bytes required to create a data structure supporting a given number of elements. More...
|
| |
|
static constexpr linear_memory_usage | memory_usage () noexcept |
| |
| static constexpr memory_size_type | memory_fits (memory_size_type memory) noexcept |
| | Return the maximum number of elements that can be contained in in the structure when it is allowed to fill a given number of bytes. More...
|
| |
template<typename T, typename child_t>
class tpie::internal_stack_vector_base< T, child_t >
A base class for a generic internal fixed size stack and vector.
- Template Parameters
-
| T | The type of items stored in the container. |
| child_t | The subtype of the class (CRTP). |
Definition at line 38 of file internal_stack_vector_base.h.
◆ internal_stack_vector_base()
template<typename T , typename child_t >
Construct structure with given capacity.
If a zero capacity is given (the default), no elements may be pushed to the structure until the structure is resized to a different capacity.
- Parameters
-
| size | Capacity of the structure. |
Definition at line 69 of file internal_stack_vector_base.h.
◆ clear()
template<typename T , typename child_t >
◆ empty()
template<typename T , typename child_t >
◆ memory_coefficient()
template<typename T , typename child_t >
Return the memory coefficient of the structure.
Allocating a structure with n elements will use at most \( \lfloor \mathrm{memory\_coefficient} \cdot n + \mathrm{memory\_overhead} \rfloor \) bytes. This does not include memory overhead incurred if the structure is allocated using new.
- Returns
- The memory coefficient of the structure.
Definition at line 51 of file internal_stack_vector_base.h.
◆ memory_fits()
template<typename child_t >
|
|
inlinestaticconstexprnoexceptinherited |
Return the maximum number of elements that can be contained in in the structure when it is allowed to fill a given number of bytes.
- Parameters
-
| memory | The number of bytes the structure is allowed to occupy |
- Returns
- The number of elements that will fit in the structure
Definition at line 118 of file util.h.
119 return static_cast<memory_size_type
>(
120 floor((memory - child_t::memory_overhead()) / child_t::memory_coefficient()));
◆ memory_overhead()
template<typename T , typename child_t >
◆ memory_usage()
template<typename child_t >
|
|
inlinestaticconstexprnoexceptinherited |
Return the number of bytes required to create a data structure supporting a given number of elements.
- Parameters
-
| size | The number of elements to support |
- Returns
- The amount of memory required in bytes
Definition at line 106 of file util.h.
107 return static_cast<memory_size_type
>(
108 floor(
static_cast<double>(size) * child_t::memory_coefficient() + child_t::memory_overhead()));
◆ resize()
template<typename T , typename child_t >
Change the capacity of the structure and clear all elements.
- Parameters
-
| size | New capacity of the structure. |
Definition at line 77 of file internal_stack_vector_base.h.
◆ size()
template<typename T , typename child_t >
◆ m_elements
template<typename T , typename child_t >
◆ m_size
template<typename T , typename child_t >
The documentation for this class was generated from the following file: