|
xentara-utils v2.0.6
The Xentara Utility Library
|
A lock free queue. More...
#include <xentara/utils/lockFree/Queue.hpp>
Public Types | |
| using | value_type = Element |
| The element type. | |
| using | allocator_type = Allocator |
| The Allocator type. | |
| using | size_type = typename std::allocator_traits< Allocator >::size_type |
| The type used for sizes. | |
| using | difference_type = typename std::allocator_traits< Allocator >::difference_type |
| The type used for distances. | |
| using | reference = value_type & |
| A reference to an element. | |
| using | const_reference = const value_type & |
| A const reference to an element. | |
| using | pointer = typename std::allocator_traits< Allocator >::pointer |
| A pointer to an element. | |
| using | const_pointer = typename std::allocator_traits< Allocator >::const_pointer |
| A const pointer to an element. | |
Public Member Functions | |
| constexpr | Queue () noexcept(noexcept(Allocator()))=default |
| Default constructor. | |
| constexpr | Queue (const Allocator &allocator) noexcept |
| Constructor that sets the allocator. | |
| Queue (size_type capacity) | |
| Constructor for a queue that can hold a specific number of elements. | |
| Queue (size_type capacity, const Allocator &allocator) | |
| Constructor for a queue that can hold a specific number of elements. | |
| template<typename... Arguments> | |
| auto | emplace (Arguments &&...arguments) noexcept(std::is_nothrow_constructible_v< Element, Arguments &&... >) -> bool |
| Push an Element onto the queue. | |
| auto | push (const Element &element) noexcept(std::is_nothrow_copy_constructible_v< Element >) -> bool |
| Push an element onto the queue without any arguments. | |
| auto | push (Element &&element) noexcept(std::is_nothrow_move_constructible_v< Element >) -> bool |
| Move an element onto the queue without any arguments. | |
| auto | pop () noexcept(std::is_nothrow_move_constructible_v< Element >) -> std::optional< Element > |
| Pop an element in an optional wrapper from the queue. | |
| auto | clear () -> void |
| Clears the queue. | |
| auto | reset (size_type capacity) -> void |
| Reset the queue to the given capacity. | |
| constexpr auto | capacity () const noexcept -> size_type |
| Gets the maximum number of elements the queue can hold. | |
| constexpr auto | max_size () const noexcept -> size_type |
| Gets the maximum possible capacity. | |
A lock free queue.
| Element | The element type |
| Allocator | the allocator for the element type |
| using xentara::utils::lockFree::Queue< Element, Allocator >::allocator_type = Allocator |
The Allocator type.
| using xentara::utils::lockFree::Queue< Element, Allocator >::const_pointer = typename std::allocator_traits<Allocator>::const_pointer |
A const pointer to an element.
| using xentara::utils::lockFree::Queue< Element, Allocator >::const_reference = const value_type & |
A const reference to an element.
| using xentara::utils::lockFree::Queue< Element, Allocator >::difference_type = typename std::allocator_traits<Allocator>::difference_type |
The type used for distances.
| using xentara::utils::lockFree::Queue< Element, Allocator >::pointer = typename std::allocator_traits<Allocator>::pointer |
A pointer to an element.
| using xentara::utils::lockFree::Queue< Element, Allocator >::reference = value_type & |
A reference to an element.
| using xentara::utils::lockFree::Queue< Element, Allocator >::size_type = typename std::allocator_traits<Allocator>::size_type |
The type used for sizes.
| using xentara::utils::lockFree::Queue< Element, Allocator >::value_type = Element |
The element type.
|
constexprdefaultnoexcept |
Default constructor.
Constructs an empty queue with a default constructed allocator.
A queue created with this constructor has a capacity of 0 and cannot hold any elements. You must make room for the elements using reset() before inserting any elements.
|
explicitconstexprnoexcept |
Constructor that sets the allocator.
A queue created with this constructor has a capacity of 0 and cannot hold any elements. You must make room for the elements using reset() before inserting any elements.
| allocator | The allocator |
|
explicit |
Constructor for a queue that can hold a specific number of elements.
| capacity | The number of entries to create room for |
|
explicit |
Constructor for a queue that can hold a specific number of elements.
| capacity | The number of entries to create room for |
| allocator | The allocator |
|
constexprnoexcept |
Gets the maximum number of elements the queue can hold.
| auto xentara::utils::lockFree::Queue< Element, Allocator >::clear | ( | ) | -> void |
Clears the queue.
Any current elements in the queue are deleted
|
noexcept |
Push an Element onto the queue.
| arguments | the arguments to use to construct the element |
|
constexprnoexcept |
Gets the maximum possible capacity.
|
noexcept |
Pop an element in an optional wrapper from the queue.
|
noexcept |
Push an element onto the queue without any arguments.
| element | the element to push onto the queue |
|
noexcept |
Move an element onto the queue without any arguments.
| element | the element to move onto the queue |
| auto xentara::utils::lockFree::Queue< Element, Allocator >::reset | ( | size_type | capacity | ) | -> void |
Reset the queue to the given capacity.
Any current elements in the queue are deleted
| capacity | The number of entries to create room for |