ORIGINAL
|
Base class for fixed-size serial containers. More...
#include <baseArray.h>
Additional Inherited Members | |
![]() | |
virtual TYPE | get (integer index) const =0 |
Retrieves the element at the specified index. | |
virtual TYPE | getBegin () const |
Retrieves the first element in the container. | |
virtual TYPE | getEnd () const |
Retrieves the last element in the container. | |
virtual TYPE | operator[] (integer index) const |
Retrieves the element at the specified index (const version). | |
virtual TYPE & | operator[] (integer index)=0 |
Retrieves or sets the element at the specified index. | |
virtual void | set (integer index, const TYPE &e)=0 |
Sets the element at the specified index. | |
virtual u_integer | indexOf (const TYPE &e) const =0 |
Finds the index of the specified element. | |
bool | contains (const TYPE &e) const override |
Checks if the container contains the specified element. | |
![]() | |
virtual u_integer | size () const =0 |
Gets the number of elements in the container. | |
bool | empty () const |
Checks if the container is empty. | |
virtual | ~container ()=default |
Destructor for the container class. | |
![]() | |
bool | indexOutOfBound (integer index) const |
Checks if the provided index is out of bounds. | |
integer | parseNegIndex (integer index) const |
Converts negative indices into valid positive indices. | |
![]() | |
container (ALLOC alloc=ALLOC{}) | |
Constructs a container with specified allocator. | |
TYPE * | allocate (u_integer size) |
Allocates raw memory for elements. | |
void | deallocate (TYPE *ptr, u_integer size) |
Deallocates memory previously allocated by allocate() | |
template<typename O_TYPE, typename... Args> | |
void | construct (O_TYPE *o_ptr, Args &&... args) |
Constructs an element in-place. | |
template<typename O_TYPE> | |
void | destroy (O_TYPE *o_ptr) |
Destroys an element. | |
![]() | |
ALLOC | allocator |
The allocator instance used for memory management. | |
Base class for fixed-size serial containers.
TYPE | Type of the elements contained in the base array |
ALLOC | Allocator type for memory management (default: allocator<TYPE>) |
This class is used as the foundation for containers with a fixed size, such as static arrays. It inherits from original::serial and provides the standard serial container functionality while maintaining a constant size throughout its existence.
The allocator is used to manage the fixed-size memory block for the array elements. Unlike dynamic containers, the allocation occurs only once during construction and remains fixed throughout the container's lifetime.
Key characteristics:
The ALLOC type must meet the C++ allocator requirements and should provide: