C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::intrusive::linked_list< T > Class Template Reference

A singly-linked list implementation. More...

#include <linked_list.hpp>

Public Types

using value_type = T
 
using node_type = typename value_type::node_type
 
using node_pointer = node_type*
 
using pointer = value_type*
 
using const_pointer = const value_type*
 
using reference = value_type&
 
using const_reference = const value_type&
 
using unique_pointer = std::unique_ptr<T>
 
using iterator = forward_iterator<value_type>
 
using const_iterator = forward_iterator<const value_type>
 

Public Member Functions

 linked_list (linked_list &&other) noexcept
 
linked_listoperator= (linked_list &&other) noexcept
 
 linked_list (const linked_list &)=delete
 
linked_listoperator= (const linked_list &)=delete
 
size_t size () const noexcept
 Returns the accumulated size of all stored tasks.
 
bool empty () const noexcept
 Returns whether the list has no elements.
 
void clear () noexcept
 Removes all elements from the list.
 
unique_pointer pop_front ()
 Removes the first element from the list and returns it.
 
iterator begin () noexcept
 Returns an iterator to the dummy before the first element.
 
const_iterator begin () const noexcept
 Returns an iterator to the dummy before the first element.
 
const_iterator cbegin () const noexcept
 Returns an iterator to the dummy before the first element.
 
iterator end () noexcept
 Returns a pointer to the dummy past the last element.
 
const_iterator end () const noexcept
 Returns a pointer to the dummy past the last element.
 
const_iterator cend () const noexcept
 Returns a pointer to the dummy past the last element.
 
iterator before_begin () noexcept
 Returns an iterator to the dummy before the first element.
 
iterator before_end () noexcept
 Returns an iterator to the last element or to the dummy before the first element if the list is empty.
 
pointer front () noexcept
 Returns a pointer to the first element.
 
pointer back () noexcept
 Returns a pointer to the last element.
 
pointer peek () noexcept
 Like front, but returns nullptr if the list is empty.
 
void push_back (pointer ptr) noexcept
 Appends ptr to the list.
 
void push_back (unique_pointer ptr) noexcept
 Appends ptr to the list.
 
template<class... Ts>
void emplace_back (Ts &&... xs)
 Creates a new element from xs... and calls push_back with it.
 
void push_front (pointer ptr) noexcept
 
void push_front (unique_pointer ptr) noexcept
 
template<class... Ts>
void emplace_front (Ts &&... xs)
 Creates a new element from xs... and calls push_front with it.
 
iterator insert_after (iterator pos, pointer ptr)
 Inserts ptr after pos.
 
template<class Predicate >
pointer find_if (Predicate pred)
 Tries to find an element in the list that matches the given predicate.
 
template<class F >
void drain (F fn)
 Transfers ownership of all elements to fn.
 

Static Public Member Functions

static pointer promote (node_pointer ptr) noexcept
 Casts a node type to its value type.
 

Detailed Description

template<class T>
class caf::intrusive::linked_list< T >

A singly-linked list implementation.

Member Function Documentation

◆ push_back() [1/2]

template<class T >
void caf::intrusive::linked_list< T >::push_back ( pointer ptr)
noexcept

Appends ptr to the list.

Precondition
ptr != nullptr

◆ push_back() [2/2]

template<class T >
void caf::intrusive::linked_list< T >::push_back ( unique_pointer ptr)
noexcept

Appends ptr to the list.

Precondition
ptr != nullptr

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