![]() |
Gaia-ECS v1.0.0
A simple and powerful entity component system
|
Array of elements of type. More...
#include <sringbuffer.h>
Public Types | |
| using | value_type = T |
| Element value type. | |
| using | reference = T & |
| Mutable element reference. | |
| using | const_reference = const T & |
| Immutable element reference. | |
| using | pointer = T * |
| Mutable element pointer. | |
| using | const_pointer = const T * |
| Immutable element pointer. | |
| using | difference_type = sringbuffer_detail::size_type |
| Type used for iterator distances. | |
| using | size_type = sringbuffer_detail::size_type |
| Type used for sizes and indices. | |
| using | iterator = sringbuffer_iterator< T, N > |
| Mutable random-access iterator. | |
| using | const_iterator = sringbuffer_iterator< const T, N > |
| Immutable random-access iterator. | |
| using | iterator_category = core::random_access_iterator_tag |
| Iterator category tag. | |
Public Member Functions | |
| template<typename InputIt > | |
| constexpr | sringbuffer (InputIt first, InputIt last) noexcept |
| Constructs a ring buffer from an iterator range. | |
| constexpr | sringbuffer (std::initializer_list< T > il) noexcept |
| Constructs a ring buffer from an initializer list. | |
| constexpr | sringbuffer (const sringbuffer &other) noexcept |
| Copy-constructs a ring buffer. | |
| constexpr | sringbuffer (sringbuffer &&other) noexcept |
| Move-constructs a ring buffer and leaves the source empty. | |
| constexpr sringbuffer & | operator= (std::initializer_list< T > il) noexcept |
| Assigns elements from an initializer list. | |
| constexpr sringbuffer & | operator= (const sringbuffer &other) |
| Copy-assigns a ring buffer. | |
| constexpr sringbuffer & | operator= (sringbuffer &&other) noexcept |
| Move-assigns a ring buffer and leaves the source empty. | |
| constexpr void | push_back (const T &arg) |
| Appends a copied element. | |
| constexpr void | push_back (T &&arg) |
| Appends a moved element. | |
| constexpr void | pop_front (T &out) |
| Removes and copies the front element. | |
| constexpr void | pop_front (T &&out) |
| Removes and moves the front element. | |
| constexpr void | pop_back (T &out) |
| Removes and copies the back element. | |
| constexpr void | pop_back (T &&out) |
| Removes and moves the back element. | |
| GAIA_NODISCARD constexpr size_type | size () const noexcept |
| Returns the number of live elements. | |
| GAIA_NODISCARD constexpr bool | empty () const noexcept |
| Checks whether the buffer is empty. | |
| GAIA_NODISCARD constexpr size_type | capacity () const noexcept |
| Returns the fixed capacity. | |
| GAIA_NODISCARD constexpr size_type | max_size () const noexcept |
| Returns the maximum element count. | |
| GAIA_NODISCARD constexpr reference | front () noexcept |
| Returns the front element. | |
| GAIA_NODISCARD constexpr const_reference | front () const noexcept |
| Returns the front element. | |
| GAIA_NODISCARD constexpr reference | back () noexcept |
| Returns the back element. | |
| GAIA_NODISCARD constexpr const_reference | back () const noexcept |
| Returns the back element. | |
| GAIA_NODISCARD constexpr auto | begin () noexcept |
| Returns an iterator to the logical front. | |
| GAIA_NODISCARD constexpr auto | begin () const noexcept |
| Returns an iterator to the logical front. | |
| GAIA_NODISCARD constexpr auto | cbegin () const noexcept |
| Returns an iterator to the logical front. | |
| GAIA_NODISCARD constexpr auto | end () noexcept |
| Returns the mutable end sentinel. | |
| GAIA_NODISCARD constexpr auto | end () const noexcept |
| Returns the immutable end sentinel. | |
| GAIA_NODISCARD constexpr auto | cend () const noexcept |
| Returns the immutable end sentinel. | |
| GAIA_NODISCARD constexpr bool | operator== (const sringbuffer &other) const |
| Compares corresponding physical storage positions. | |
Public Attributes | |
| size_type | m_tail {} |
| Physical index of the logical front element. | |
| size_type | m_size {} |
| Number of live elements. | |
| T | m_data [N] |
| Physical element storage. | |
Static Public Attributes | |
| static constexpr size_type | extent = N |
| Compile-time buffer capacity. | |
Array of elements of type.
| T | with fixed size and capacity |
| N | allocated on stack working as a ring buffer. That means the element at position N-1 is followed by the element at the position 0. Interface compatiblity with std::array where it matters. |
|
inlineconstexprnoexcept |
Constructs a ring buffer from an iterator range.
| InputIt | Input iterator type. |
| first | First element to copy. |
| last | Sentinel following the last element to copy. |
|
inlineconstexprnoexcept |
Constructs a ring buffer from an initializer list.
| il | Elements to copy in logical order. |
|
inlineconstexprnoexcept |
Copy-constructs a ring buffer.
| other | Ring buffer to copy. |
|
inlineconstexprnoexcept |
Move-constructs a ring buffer and leaves the source empty.
| other | Ring buffer whose elements are transferred. |
|
inlineconstexprnoexcept |
Returns the back element.
|
inlineconstexprnoexcept |
Returns the back element.
|
inlineconstexprnoexcept |
Returns an iterator to the logical front.
|
inlineconstexprnoexcept |
Returns an iterator to the logical front.
|
inlineconstexprnoexcept |
Returns the fixed capacity.
|
inlineconstexprnoexcept |
Returns an iterator to the logical front.
|
inlineconstexprnoexcept |
Returns the immutable end sentinel.
|
inlineconstexprnoexcept |
Checks whether the buffer is empty.
|
inlineconstexprnoexcept |
Returns the immutable end sentinel.
|
inlineconstexprnoexcept |
Returns the mutable end sentinel.
|
inlineconstexprnoexcept |
Returns the front element.
|
inlineconstexprnoexcept |
Returns the front element.
|
inlineconstexprnoexcept |
Returns the maximum element count.
|
inlineconstexpr |
Copy-assigns a ring buffer.
| other | Ring buffer to copy. |
|
inlineconstexprnoexcept |
Move-assigns a ring buffer and leaves the source empty.
| other | Ring buffer whose elements are transferred. |
|
inlineconstexprnoexcept |
Assigns elements from an initializer list.
| il | Elements to copy in logical order. |
|
inlineconstexpr |
Compares corresponding physical storage positions.
| other | Ring buffer to compare with. |
Removes and moves the back element.
| out | Destination receiving the removed element. |
Removes and copies the back element.
| out | Destination receiving the removed element. |
Removes and moves the front element.
| out | Destination receiving the removed element. |
Removes and copies the front element.
| out | Destination receiving the removed element. |
Appends a copied element.
| arg | Element to append. The buffer must not be full. |
Appends a moved element.
| arg | Element to move into the buffer. The buffer must not be full. |
|
inlineconstexprnoexcept |
Returns the number of live elements.