0.2.0
|
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. | |
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. |
|
inlineexplicit |
Constructs an empty container with the given allocator alloc.
alloc | Allocator to use for all memory allocations of this container |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
inline |
Returns a reference to the last element in the container.
|
inline |
Returns a reference to the last element in the container.
|
inlinenoexcept |
Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().
|
inlinenoexcept |
Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().
|
inlinenoexcept |
Returns an iterator to the first element of the deque. If the deque is empty, the returned iterator will be equal to end().
|
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.
|
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.
|
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().
|
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.
|
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 |
|
inline |
Appends a new element to the end of the container.
[in] | args | Arguments to forward to the constructor of the element |
|
inline |
Inserts a new element to the beginning of the container.
[in] | args | Arguments to forward to the constructor of the element |
|
inlinenoexcept |
|
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.
|
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.
|
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 |
|
inline |
Removes the element at pos.
[in] | pos | Iterator to the element to remove |
|
inline |
Returns a copy of the first element in the container and removes it from the container.
|
inline |
Returns a reference to the first element in the container.
|
inline |
Returns a reference to the first element in the container.
|
inlinenoexcept |
Returns the allocator associated with the container.
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
inlinenoexcept |
|
inline |
Replaces the contents with those identified by initializer list ilist.
ilist | Initializer list to use as data source |
|
inline |
Returns a reference to the element at specified location pos. No bounds checking is performed.
[in] | pos | Position of the element to return |
|
inline |
Returns a reference to the element at specified location pos. No bounds checking is performed.
[in] | pos | Position of the element to return |
|
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 |
|
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 |
|
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 |
|
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 |
|
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().
|
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().
|
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.
|
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.
|
inline |
Resizes the container to contain count elements.
[in] | count | New size of the container |
|
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 |
|
inlinenoexcept |
|
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 |