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()
.
std::array
publicly, 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.T | The type to store. |
TSize | The fixed sitze of the vector. |
Definition at line 44 of file fixedcapacityvector.hpp.
#include <fixedcapacityvector.hpp>
Public Method Index: | |
void | pop_back () |
void | push_back (const T &value) |
Protected Field Index: | |
std::size_t | fillSize = 0 |
The current fill. | |
|
protected |
The current fill.
Definition at line 47 of file fixedcapacityvector.hpp.
|
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 64 of file fixedcapacityvector.hpp.
|
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.
value | The value to insert. |
Definition at line 54 of file fixedcapacityvector.hpp.