C/C++ API Reference
Loading...
Searching...
No Matches
pw::IntrusiveQueue< T > Class Template Reference

Overview

template<typename T>
class pw::IntrusiveQueue< T >

An IntrusiveQueue is a singly-linked list similar to IntrusiveForwardList but tracks the tail element to provide O(1) push_back support. It does not support pop_back().

Classes

class  Item
 

Public Types

using element_type = T
 
using value_type = std::remove_cv_t< element_type >
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using reference = value_type &
 
using const_reference = const value_type &
 
using pointer = element_type *
 
using const_pointer = const element_type *
 
using iterator = typename containers::internal::ForwardIterator< T, ItemBase >
 
using const_iterator = typename containers::internal::ForwardIterator< std::add_const_t< T >, const ItemBase >
 

Public Member Functions

 IntrusiveQueue (const IntrusiveQueue &)=delete
 
IntrusiveQueueoperator= (const IntrusiveQueue &)=delete
 
 IntrusiveQueue (IntrusiveQueue &&)=default
 Moves the other queue's contents into this queue.
 
IntrusiveQueueoperator= (IntrusiveQueue &&)=default
 Clears this queue and moves the other queue's contents into it.
 
template<typename Iterator >
 IntrusiveQueue (Iterator first, Iterator last)
 Constructs a queue from an iterator over items.
 
 IntrusiveQueue (std::initializer_list< T * > items)
 Constructs a queue from a std::initializer_list of pointers to items.
 
template<typename Iterator >
void assign (Iterator first, Iterator last)
 
void assign (std::initializer_list< T * > items)
 
iterator before_begin () noexcept
 
const_iterator before_begin () const noexcept
 
const_iterator cbefore_begin () const noexcept
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
bool empty () const noexcept
 
constexpr size_type max_size () const noexcept
 
void clear ()
 
void push_front (T &item)
 Inserts an element at the beginning of the queue.
 
void pop_front ()
 Removes the first element of the queue.
 
void push_back (T &item)
 Inserts an element at the end of the queue in O(1) time.
 
iterator insert_after (iterator pos, T &item)
 Inserts item after the specified pos.
 
template<typename Iterator >
iterator insert_after (iterator pos, Iterator first, Iterator last)
 Inserts a range after the specified pos.
 
iterator insert_after (iterator pos, std::initializer_list< T * > items)
 Inserts an initializer list after the specified pos.
 
iterator erase_after (iterator pos)
 Removes the item succeeding pos.
 
iterator erase_after (iterator first, iterator last)
 Removes a range of items.
 
bool remove (const T &item_to_remove)
 
template<typename UnaryPredicate >
size_type remove_if (UnaryPredicate &&pred)
 Removes any item for which the given unary predicate evaluates to true.
 
void swap (IntrusiveQueue< T > &other) noexcept
 

Member Function Documentation

◆ remove()

template<typename T >
bool pw::IntrusiveQueue< T >::remove ( const T &  item_to_remove)
inline

Removes this specific item from the list, if it is present. Unsafe to use raw unlist() if you want the queue tail_ to be preserved. This method properly updates the tail_ iterator if the removed item is the tail.


The documentation for this class was generated from the following file: