Static List#

Defined in namespace hal

#include <libhal-util/static_list.hpp>

group StaticList

Functions

inline constexpr item push_back()#

Add default constructed item to the end of the list.

Only works for Object’s that support default construction.

Returns:

constexpr item - item with default constructed value

inline constexpr item push_back(const Object &p_value)#

Append item to the end of the static list.

Parameters:

p_value – - value of node

Returns:

constexpr item - item with constructed value based on the input

inline constexpr item push_back(Object &&p_value)#

Append item to the end of the static list.

Parameters:

p_value – - value of node

Returns:

constexpr item - item with constructed value based on the input

template<class Object>
class static_list#
#include <static_list.hpp>

static_list is a non-owning non-allocating doubly linked list container with O(1) memory utilization.

Items in the list cannot be destroyed by

Template Parameters:

Object – - The type of the elements. Object must be “MoveAssignable” and “MoveConstructible”.

Public Functions

inline constexpr item push_back()#

Add default constructed item to the end of the list.

Only works for Object’s that support default construction.

Returns:

constexpr item - item with default constructed value

inline constexpr item push_back(const Object &p_value)#

Append item to the end of the static list.

Parameters:

p_value – - value of node

Returns:

constexpr item - item with constructed value based on the input

inline constexpr item push_back(Object &&p_value)#

Append item to the end of the static list.

Parameters:

p_value – - value of node

Returns:

constexpr item - item with constructed value based on the input

class item#
#include <static_list.hpp>

Item/node within the static linked list.

This object does not allow copies. When moved, the object will determine its new location in memory, and will update the linked list to the new location and invalidate the old location. This ensures that this item’s position in memory, if whether returned from a function or relocated in some other way, is always tracked by the list.

An item can only be removed from the list if it is no longer accessible (goes out of scope) or is destructed explicitly (DO NOT DO THIS).

The return value of push_back MUST be saved to a variable. Failing to do so will result in the object being destructed and removed from the list due to it being inaccessible.

static_list<int> list;
auto item = list.push_back(5);

class item_iterator#
#include <static_list.hpp>

Iterator for the static list.

Implements the C++ named requirement of “LegacyBidirectionalIterator”.

class item
#include <static_list.hpp>

Item/node within the static linked list.

This object does not allow copies. When moved, the object will determine its new location in memory, and will update the linked list to the new location and invalidate the old location. This ensures that this item’s position in memory, if whether returned from a function or relocated in some other way, is always tracked by the list.

An item can only be removed from the list if it is no longer accessible (goes out of scope) or is destructed explicitly (DO NOT DO THIS).

The return value of push_back MUST be saved to a variable. Failing to do so will result in the object being destructed and removed from the list due to it being inaccessible.

static_list<int> list;
auto item = list.push_back(5);

class item_iterator
#include <static_list.hpp>

Iterator for the static list.

Implements the C++ named requirement of “LegacyBidirectionalIterator”.