ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
FixedCapacityVector< T, TSize > Class Template Reference

Description:

template<typename T, std::size_t TSize>
class alib::monomem::util::FixedCapacityVector< T, TSize >

This class fills the gap between standard types std::array and std::vector by implementing a fixed size array, with a current filling size index. With that methods push_back and pop_back could be implemented, which satisfies the constraints given for example to underlying containers of type std::priority_queue.

The rationale here is to use fixed size memory allocation or even stack allocation, in situations where the maximum capacity needed at runtime is known upfront.

Besides aforementioned methods push_back and pop_back, a few necessary other methods of parent class std::array have been replaced, but are not explicitly mentioned with this reference documentation. Among them are size(), end(), rend() or cend().

Attention
While this type inherits std::array publically, not all standard methods and type traits have been overwritten according to the ever more complicated C++ specification. Therefore, there is not only no guarantee given that this type behaves as it is supposed to in each and every complex situation (e.g template meta programing). However, the use in accordance with type std::priority_queue is certified.

Definition at line 46 of file fixedcapacityvector.hpp.

#include <fixedcapacityvector.hpp>

Inheritance diagram for FixedCapacityVector< T, TSize >:
[legend]
Collaboration diagram for FixedCapacityVector< T, TSize >:
[legend]

Public Method Index:

void pop_back ()
 
void push_back (const T &value)
 

Field Details:

◆ fillSize

template<typename T , std::size_t TSize>
std::size_t fillSize = 0
protected

The current fill.

Definition at line 49 of file fixedcapacityvector.hpp.

Method Details:

◆ pop_back()

template<typename T , std::size_t TSize>
void pop_back ( )
inline

Decreases the size of this vector by destructing and removing the given value at the current end.
In debug compilations, an ALib assertion is raised, if no elements are left.

Definition at line 70 of file fixedcapacityvector.hpp.

◆ push_back()

template<typename T , std::size_t TSize>
void push_back ( const T & value)
inline

Increases the size of this vector by inserting given value at the end.
In debug compilations, an ALib assertion is raised, if this fixed sized vector's capacity is exceeded.

Parameters
valueThe value to insert.

Definition at line 58 of file fixedcapacityvector.hpp.


The documentation for this class was generated from the following file: