![]() |
0.4.1
|
Thread-safe deque. More...
Public Member Functions | |
template<class InputIt> | |
void | assign (InputIt first, InputIt last) |
Replaces the contents with copies of those in the range [first, last). The behavior is undefined if either argument is an iterator into *this. | |
void | assign (std::initializer_list< T > ilist) |
Replaces the contents with the elements from the initializer list ilist. | |
void | assign (typename std::deque< T, Alloc >::size_type count, const T &value) |
Replaces the contents with count copies of value value. | |
auto & | at (typename std::deque< T, Alloc >::size_type pos) |
Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown. | |
const auto & | at (typename std::deque< T, Alloc >::size_type pos) const |
Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown. | |
auto & | back () |
Returns a reference to the last element in the container. | |
const auto & | back () const |
Returns a reference to the last element in the container. | |
std::deque< T >::const_iterator | begin () const noexcept |
Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end(). | |
std::deque< T >::iterator | begin () noexcept |
Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end(). | |
std::deque< T >::const_iterator | cbegin () const noexcept |
Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end(). | |
std::deque< T >::const_iterator | cend () const noexcept |
Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior. | |
void | clear () noexcept |
std::deque< T >::const_reverse_iterator | crbegin () const noexcept |
Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend(). | |
std::deque< T >::const_reverse_iterator | crend () const noexcept |
Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior. | |
template<class... Args> | |
std::deque< T >::iterator | emplace (typename std::deque< T >::const_iterator pos, Args &&... args) |
Inserts a new element into the container directly before pos. | |
template<class... Args> | |
auto & | emplace_back (Args &&... args) |
Appends a new element to the end of the container. | |
template<class... Args> | |
auto & | emplace_front (Args &&... args) |
Inserts a new element to the beginning of the container. | |
bool | empty () const noexcept |
Checks if the container has no elements, i.e. whether 'begin() == end()'. | |
std::deque< T >::const_iterator | end () const noexcept |
Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior. | |
std::deque< T >::iterator | end () noexcept |
Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior. | |
std::deque< T >::iterator | erase (typename std::deque< T >::const_iterator first, typename std::deque< T >::const_iterator last) |
Removes the elements in the range [first, last). All iterators and references are invalidated, unless the erased elements are at the end or the beginning of the container, in which case only the iterators and references to the erased elements are invalidated. | |
std::deque< T >::iterator | erase (typename std::deque< T >::const_iterator pos) |
Removes the element at pos. | |
auto | extract_front () |
Returns a copy of the first element in the container and removes it from the container. | |
auto & | front () |
Returns a reference to the first element in the container. | |
const auto & | front () const |
Returns a reference to the first element in the container. | |
std::deque< T, Alloc >::allocator_type | get_allocator () const noexcept |
Returns the allocator associated with the container. | |
std::deque< T >::iterator | insert (typename std::deque< T >::const_iterator pos, const T &value) |
Insert value before pos in the container. | |
template<class InputIt> | |
std::deque< T >::iterator | insert (typename std::deque< T >::const_iterator pos, InputIt first, InputIt last) |
inserts elements from range [first, last) before pos. | |
std::deque< T >::iterator | insert (typename std::deque< T >::const_iterator pos, std::initializer_list< T > ilist) |
Inserts elements from initializer list ilist before pos. | |
std::deque< T >::iterator | insert (typename std::deque< T >::const_iterator pos, T &&value) |
Insert value before pos in the container. | |
std::deque< T >::iterator | insert (typename std::deque< T >::const_iterator pos, typename std::deque< T, Alloc >::size_type count, const T &value) |
inserts count copies of the value before pos | |
std::deque< T, Alloc >::size_type | max_size () const noexcept |
Returns the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest container. | |
TsDeque & | operator= (const TsDeque &other) |
Copy assignment operator. | |
TsDeque & | operator= (std::initializer_list< T > ilist) |
Replaces the contents with those identified by initializer list ilist. | |
TsDeque & | operator= (TsDeque &&other) noexcept |
Move assignment operator. | |
auto & | operator[] (typename std::deque< T, Alloc >::size_type pos) |
Returns a reference to the element at specified location pos. No bounds checking is performed. | |
const auto & | operator[] (typename std::deque< T, Alloc >::size_type pos) const |
Returns a reference to the element at specified location pos. No bounds checking is performed. | |
void | pop_back () |
Removes the last element of the container. | |
void | pop_front () |
Removes the first element of the container. If there are no elements in the container, the behavior is undefined. | |
void | push_back (const T &value) |
Appends the given element value to the end of the container. The new element is initialized as a copy of value. | |
void | push_back (T &&value) |
Appends the given element value to the end of the container. Value is moved into the new element. | |
void | push_front (const T &value) |
Prepends the given element value to the beginning of the container. The new element is initialized as a copy of value. All iterators, including the past-the-end iterator, are invalidated. No references are invalidated. | |
void | push_front (T &&value) |
Prepends the given element value to the beginning of the container. Value is moved into the new element. All iterators, including the past-the-end iterator, are invalidated. No references are invalidated. | |
std::deque< T >::const_reverse_iterator | rbegin () const noexcept |
Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend(). | |
std::deque< T >::reverse_iterator | rbegin () noexcept |
Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend(). | |
std::deque< T >::const_reverse_iterator | rend () const noexcept |
Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior. | |
std::deque< T >::reverse_iterator | rend () noexcept |
Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior. | |
void | resize (typename std::deque< T, Alloc >::size_type count) |
Resizes the container to contain count elements. | |
void | resize (typename std::deque< T, Alloc >::size_type count, const T &value) |
Resizes the container to contain count elements. | |
void | shrink_to_fit () |
Requests the removal of unused capacity. | |
std::deque< T, Alloc >::size_type | size () const noexcept |
Returns the number of elements in the container, i.e. std::distance(begin(), end()). | |
void | swap (std::deque< T > &other) noexcept |
Exchanges the contents of the container with those of other. Does not invoke any move, copy, or swap operations on individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated. | |
TsDeque ()=default | |
Default Constructor. Constructs an empty container with a default-constructed allocator. | |
TsDeque (const Alloc &alloc) | |
Constructs an empty container with the given allocator alloc. | |
TsDeque (const TsDeque &other) | |
Copy constructor. Constructs the container with the copy of the contents of other. | |
TsDeque (const TsDeque &other, const Alloc &alloc) | |
Constructs the container with the copy of the contents of other, using alloc as the allocator. | |
template<class InputIt> | |
TsDeque (InputIt first, InputIt last, const Alloc &alloc=Alloc()) | |
Constructs the container with the contents of the range [first, last). | |
TsDeque (std::initializer_list< T > init, const Alloc &alloc=Alloc()) | |
Constructs the container with the contents of the initializer list init. | |
TsDeque (TsDeque &&other) noexcept | |
Move constructor. Constructs the container with the contents of other using move semantics. Allocator is obtained by move-construction from the allocator belonging to other. | |
TsDeque (TsDeque &&other, const Alloc &alloc) noexcept | |
Allocator-extended move constructor. Using alloc as the allocator for the new container, moving the contents from other; if alloc != other.get_allocator(), this results in an element-wise move. | |
TsDeque (typename std::deque< T, Alloc >::size_type count, const Alloc &alloc=Alloc()) | |
Constructs the container with count default-inserted instances of T. No copies are made. | |
TsDeque (typename std::deque< T, Alloc >::size_type count, const T &value, const Alloc &alloc=Alloc()) | |
Constructs the container with count copies of elements with value value. | |
~TsDeque ()=default | |
Destructor. | |
Private Attributes | |
std::mutex | _mutex |
Mutex to interact with the queue object. | |
std::deque< T, Alloc > | _queue |
Queue with received data. | |
Thread-safe deque.
T | The type of the elements. |
Alloc | Allocator that is used to acquire/release memory and to construct/destroy the elements in that memory. |
Definition at line 26 of file TsDeque.hpp.
|
default |
Default Constructor. Constructs an empty container with a default-constructed allocator.
|
default |
Destructor.
|
inlineexplicit |
Constructs an empty container with the given allocator alloc.
alloc | Allocator to use for all memory allocations of this container |
Definition at line 41 of file TsDeque.hpp.
|
inline |
Constructs the container with count copies of elements with value value.
count | The size of the container |
value | The value to initialize elements of the container with |
alloc | Allocator to use for all memory allocations of this container |
Definition at line 48 of file TsDeque.hpp.
|
inlineexplicit |
Constructs the container with count default-inserted instances of T. No copies are made.
count | The size of the container |
alloc | Allocator to use for all memory allocations of this container |
Definition at line 54 of file TsDeque.hpp.
|
inline |
Constructs the container with the contents of the range [first, last).
first | First element of the range to copy the elements from |
last | Last element the range to copy the elements from |
alloc | Allocator to use for all memory allocations of this container |
Definition at line 62 of file TsDeque.hpp.
|
inline |
Copy constructor. Constructs the container with the copy of the contents of other.
other | Another container to be used as source to initialize the elements of the container with |
Definition at line 68 of file TsDeque.hpp.
|
inline |
Constructs the container with the copy of the contents of other, using alloc as the allocator.
other | Another container to be used as source to initialize the elements of the container with |
alloc | Allocator to use for all memory allocations of this container |
Definition at line 76 of file TsDeque.hpp.
|
inlinenoexcept |
Move constructor. Constructs the container with the contents of other using move semantics. Allocator is obtained by move-construction from the allocator belonging to other.
other | Another container to be used as source to initialize the elements of the container with |
Definition at line 84 of file TsDeque.hpp.
|
inlinenoexcept |
Allocator-extended move constructor. Using alloc as the allocator for the new container, moving the contents from other; if alloc != other.get_allocator(), this results in an element-wise move.
other | Another container to be used as source to initialize the elements of the container with |
alloc | Allocator to use for all memory allocations of this container |
Definition at line 93 of file TsDeque.hpp.
|
inline |
Constructs the container with the contents of the initializer list init.
init | Initializer list to initialize the elements of the container with |
alloc | Allocator to use for all memory allocations of this container |
Definition at line 101 of file TsDeque.hpp.
|
inline |
Replaces the contents with copies of those in the range [first, last). The behavior is undefined if either argument is an iterator into *this.
All iterators, pointers and references to the elements of the container are invalidated. The past-the-end iterator is also invalidated.
[in] | first | The first element of the range to copy the elements from |
[in] | last | The last element of the range to copy the elements from |
Definition at line 150 of file TsDeque.hpp.
|
inline |
Replaces the contents with the elements from the initializer list ilist.
All iterators, pointers and references to the elements of the container are invalidated. The past-the-end iterator is also invalidated.
ilist | Initializer list to copy the values from |
Definition at line 159 of file TsDeque.hpp.
|
inline |
Replaces the contents with count copies of value value.
All iterators, pointers and references to the elements of the container are invalidated. The past-the-end iterator is also invalidated.
count | The new size of the container |
value | The value to initialize elements of the container with |
Definition at line 138 of file TsDeque.hpp.
|
inline |
Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown.
[in] | pos | Position of the element to return |
Definition at line 180 of file TsDeque.hpp.
|
inline |
Returns a reference to the element at specified location pos, with bounds checking. If pos is not within the range of the container, an exception of type std::out_of_range is thrown.
[in] | pos | Position of the element to return |
Definition at line 185 of file TsDeque.hpp.
|
inline |
Returns a reference to the last element in the container.
Definition at line 205 of file TsDeque.hpp.
|
inline |
Returns a reference to the last element in the container.
Definition at line 208 of file TsDeque.hpp.
|
inlinenoexcept |
Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().
Definition at line 221 of file TsDeque.hpp.
|
inlinenoexcept |
Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().
Definition at line 217 of file TsDeque.hpp.
|
inlinenoexcept |
Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().
Definition at line 225 of file TsDeque.hpp.
|
inlinenoexcept |
Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior.
Definition at line 238 of file TsDeque.hpp.
|
inlinenoexcept |
Erases all elements from the container. After this call, size() returns zero. Invalidates any references, pointers, or iterators referring to contained elements. Any past-the-end iterators are also invalidated.
Definition at line 310 of file TsDeque.hpp.
|
inlinenoexcept |
Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend().
Definition at line 251 of file TsDeque.hpp.
|
inlinenoexcept |
Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior.
Definition at line 267 of file TsDeque.hpp.
|
inline |
Inserts a new element into the container directly before pos.
[in] | pos | Iterator before which the new element will be constructed |
[in] | args | Arguments to forward to the constructor of the element |
Definition at line 375 of file TsDeque.hpp.
|
inline |
Appends a new element to the end of the container.
[in] | args | Arguments to forward to the constructor of the element |
Definition at line 420 of file TsDeque.hpp.
|
inline |
Inserts a new element to the beginning of the container.
[in] | args | Arguments to forward to the constructor of the element |
Definition at line 454 of file TsDeque.hpp.
|
inlinenodiscardnoexcept |
Checks if the container has no elements, i.e. whether 'begin() == end()'.
Definition at line 275 of file TsDeque.hpp.
|
inlinenoexcept |
Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior.
Definition at line 234 of file TsDeque.hpp.
|
inlinenoexcept |
Returns an iterator to the element following the last element of the deque. This element acts as a placeholder; attempting to access it results in undefined behavior.
Definition at line 230 of file TsDeque.hpp.
|
inline |
Removes the elements in the range [first, last). All iterators and references are invalidated, unless the erased elements are at the end or the beginning of the container, in which case only the iterators and references to the erased elements are invalidated.
[in] | first | First element of the range of elements to remove |
[in] | last | Last element of the range of elements to remove |
Definition at line 395 of file TsDeque.hpp.
|
inline |
Removes the element at pos.
[in] | pos | Iterator to the element to remove |
Definition at line 384 of file TsDeque.hpp.
|
inline |
Returns a copy of the first element in the container and removes it from the container.
Definition at line 494 of file TsDeque.hpp.
|
inline |
Returns a reference to the first element in the container.
Definition at line 198 of file TsDeque.hpp.
|
inline |
Returns a reference to the first element in the container.
Definition at line 201 of file TsDeque.hpp.
|
inlinenoexcept |
Returns the allocator associated with the container.
Definition at line 167 of file TsDeque.hpp.
|
inline |
Insert value before pos in the container.
[in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator |
[in] | value | Element value to insert |
Definition at line 320 of file TsDeque.hpp.
|
inline |
inserts elements from range [first, last) before pos.
InputIt | Input iterator type |
[in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator |
[in] | first | The first element of the range of elements to insert, can't be iterators into container for which insert is called |
[in] | last | The last element of the range of elements to insert, can't be iterators into container for which insert is called |
Definition at line 354 of file TsDeque.hpp.
|
inline |
Inserts elements from initializer list ilist before pos.
[in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator |
[in] | ilist | Initializer list to insert the values from |
Definition at line 364 of file TsDeque.hpp.
|
inline |
Insert value before pos in the container.
[in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator |
[in] | value | Element value to insert |
Definition at line 330 of file TsDeque.hpp.
|
inline |
inserts count copies of the value before pos
[in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator |
[in] | count | Number of elements to insert |
[in] | value | Element value to insert |
Definition at line 341 of file TsDeque.hpp.
|
inlinenoexcept |
Returns the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest container.
Definition at line 291 of file TsDeque.hpp.
|
inline |
Copy assignment operator.
Definition at line 105 of file TsDeque.hpp.
|
inline |
Replaces the contents with those identified by initializer list ilist.
ilist | Initializer list to use as data source |
Definition at line 128 of file TsDeque.hpp.
|
inlinenoexcept |
Move assignment operator.
Definition at line 116 of file TsDeque.hpp.
|
inline |
Returns a reference to the element at specified location pos. No bounds checking is performed.
[in] | pos | Position of the element to return |
Definition at line 190 of file TsDeque.hpp.
|
inline |
Returns a reference to the element at specified location pos. No bounds checking is performed.
[in] | pos | Position of the element to return |
Definition at line 194 of file TsDeque.hpp.
|
inline |
Removes the last element of the container.
Definition at line 427 of file TsDeque.hpp.
|
inline |
Removes the first element of the container. If there are no elements in the container, the behavior is undefined.
Definition at line 461 of file TsDeque.hpp.
|
inline |
Appends the given element value to the end of the container. The new element is initialized as a copy of value.
[in] | value | The value of the element to append |
Definition at line 403 of file TsDeque.hpp.
|
inline |
Appends the given element value to the end of the container. Value is moved into the new element.
[in] | value | The value of the element to append |
Definition at line 410 of file TsDeque.hpp.
|
inline |
Prepends the given element value to the beginning of the container. The new element is initialized as a copy of value. All iterators, including the past-the-end iterator, are invalidated. No references are invalidated.
[in] | value | The value of the element to prepend |
Definition at line 436 of file TsDeque.hpp.
|
inline |
Prepends the given element value to the beginning of the container. Value is moved into the new element. All iterators, including the past-the-end iterator, are invalidated. No references are invalidated.
[in] | value | The value of the element to prepend |
Definition at line 444 of file TsDeque.hpp.
|
inlinenoexcept |
Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend().
Definition at line 247 of file TsDeque.hpp.
|
inlinenoexcept |
Returns a reverse iterator to the first element of the reversed deque. It corresponds to the last element of the non-reversed deque. If the deque is empty, the returned iterator is equal to rend().
Definition at line 243 of file TsDeque.hpp.
|
inlinenoexcept |
Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior.
Definition at line 262 of file TsDeque.hpp.
|
inlinenoexcept |
Returns a reverse iterator to the element following the last element of the reversed deque. It corresponds to the element preceding the first element of the non-reversed deque. This element acts as a placeholder, attempting to access it results in undefined behavior.
Definition at line 257 of file TsDeque.hpp.
|
inline |
Resizes the container to contain count elements.
[in] | count | New size of the container |
Definition at line 469 of file TsDeque.hpp.
|
inline |
Resizes the container to contain count elements.
[in] | count | New size of the container |
[in] | value | The value to initialize the new elements with |
Definition at line 477 of file TsDeque.hpp.
|
inline |
Requests the removal of unused capacity.
Definition at line 298 of file TsDeque.hpp.
|
inlinenoexcept |
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Definition at line 283 of file TsDeque.hpp.
|
inlinenoexcept |
Exchanges the contents of the container with those of other. Does not invoke any move, copy, or swap operations on individual elements. All iterators and references remain valid. The past-the-end iterator is invalidated.
[in,out] | other | Container to exchange the contents with |
Definition at line 486 of file TsDeque.hpp.
|
mutableprivate |
Mutex to interact with the queue object.
Definition at line 510 of file TsDeque.hpp.
|
private |
Queue with received data.
Definition at line 507 of file TsDeque.hpp.