Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::intrusive::linear_slist_algorithms< NodeTraits > Class Template Reference

linear_slist_algorithms provides basic algorithms to manipulate nodes forming a linear singly linked list. More...

#include <linear_slist_algorithms.hpp>

Public Types

typedef NodeTraits::node node
 
typedef NodeTraits::node_ptr node_ptr
 
typedef NodeTraits::const_node_ptr const_node_ptr
 
typedef NodeTraits node_traits
 

Static Public Member Functions

static void init_header (const node_ptr &this_node)
 Effects: Constructs an empty list, making this_node the only node of the circular list: NodeTraits::get_next(this_node) == this_node. More...
 
static node_ptr get_previous_node (const node_ptr &prev_init_node, const node_ptr &this_node)
 Requires: this_node and prev_init_node must be in the same linear list. More...
 
static std::size_t count (const const_node_ptr &this_node)
 Requires: this_node must be in a linear list or be an empty linear list. More...
 
static void swap_trailing_nodes (const node_ptr &this_node, const node_ptr &other_node)
 Requires: this_node and other_node must be nodes inserted in linear lists or be empty linear lists. More...
 
static node_ptr reverse (const node_ptr &p)
 Effects: Reverses the order of elements in the list. More...
 
static std::pair< node_ptr,
node_ptr
move_first_n_backwards (const node_ptr &p, std::size_t n)
 Effects: Moves the first n nodes starting at p to the end of the list. More...
 
static std::pair< node_ptr,
node_ptr
move_first_n_forward (const node_ptr &p, std::size_t n)
 Effects: Moves the first n nodes starting at p to the beginning of the list. More...
 

Detailed Description

template<class NodeTraits>
class boost::intrusive::linear_slist_algorithms< NodeTraits >

linear_slist_algorithms provides basic algorithms to manipulate nodes forming a linear singly linked list.

linear_slist_algorithms is configured with a NodeTraits class, which encapsulates the information about the node to be manipulated. NodeTraits must support the following interface:

Typedefs:

node: The type of the node that forms the linear list

node_ptr: A pointer to a node

const_node_ptr: A pointer to a const node

Static functions:

static node_ptr get_next(const_node_ptr n);

static void set_next(node_ptr n, node_ptr next);

Member Typedef Documentation

template<class NodeTraits >
typedef NodeTraits::const_node_ptr boost::intrusive::linear_slist_algorithms< NodeTraits >::const_node_ptr
template<class NodeTraits >
typedef NodeTraits::node boost::intrusive::linear_slist_algorithms< NodeTraits >::node
template<class NodeTraits >
typedef NodeTraits::node_ptr boost::intrusive::linear_slist_algorithms< NodeTraits >::node_ptr
template<class NodeTraits >
typedef NodeTraits boost::intrusive::linear_slist_algorithms< NodeTraits >::node_traits

Member Function Documentation

template<class NodeTraits >
static std::size_t boost::intrusive::linear_slist_algorithms< NodeTraits >::count ( const const_node_ptr this_node)
inlinestatic

Requires: this_node must be in a linear list or be an empty linear list.

Effects: Returns the number of nodes in a linear list. If the linear list is empty, returns 1.

Complexity: Linear

Throws: Nothing.

References boost::multiprecision::backends::p.

template<class NodeTraits >
static node_ptr boost::intrusive::linear_slist_algorithms< NodeTraits >::get_previous_node ( const node_ptr prev_init_node,
const node_ptr this_node 
)
inlinestatic

Requires: this_node and prev_init_node must be in the same linear list.

Effects: Returns the previous node of this_node in the linear list starting. the search from prev_init_node. The first node checked for equality is NodeTraits::get_next(prev_init_node).

Complexity: Linear to the number of elements between prev_init_node and this_node.

Throws: Nothing.

template<class NodeTraits >
static void boost::intrusive::linear_slist_algorithms< NodeTraits >::init_header ( const node_ptr this_node)
inlinestatic

Effects: Constructs an empty list, making this_node the only node of the circular list: NodeTraits::get_next(this_node) == this_node.

Complexity: Constant

Throws: Nothing.

template<class NodeTraits >
static std::pair<node_ptr, node_ptr> boost::intrusive::linear_slist_algorithms< NodeTraits >::move_first_n_backwards ( const node_ptr p,
std::size_t  n 
)
inlinestatic

Effects: Moves the first n nodes starting at p to the end of the list.

Returns: A pair containing the new first and last node of the list or if there has been any movement, a null pair if n leads to no movement.

Throws: Nothing.

Complexity: Linear to the number of elements plus the number moved positions.

References boost::xpressive::first, boost::multiprecision::backends::i, boost::n, and boost::multiprecision::backends::p.

template<class NodeTraits >
static std::pair<node_ptr, node_ptr> boost::intrusive::linear_slist_algorithms< NodeTraits >::move_first_n_forward ( const node_ptr p,
std::size_t  n 
)
inlinestatic

Effects: Moves the first n nodes starting at p to the beginning of the list.

Returns: A pair containing the new first and last node of the list or if there has been any movement, a null pair if n leads to no movement.

Throws: Nothing.

Complexity: Linear to the number of elements plus the number moved positions.

References boost::distance(), boost::xpressive::first, and boost::multiprecision::backends::p.

template<class NodeTraits >
static node_ptr boost::intrusive::linear_slist_algorithms< NodeTraits >::reverse ( const node_ptr p)
inlinestatic

Effects: Reverses the order of elements in the list.

Returns: The new first node of the list.

Throws: Nothing.

Complexity: This function is linear to the contained elements.

References boost::xpressive::first, and boost::multiprecision::backends::i.

template<class NodeTraits >
static void boost::intrusive::linear_slist_algorithms< NodeTraits >::swap_trailing_nodes ( const node_ptr this_node,
const node_ptr other_node 
)
inlinestatic

Requires: this_node and other_node must be nodes inserted in linear lists or be empty linear lists.

Effects: Moves all the nodes previously chained after this_node after other_node and vice-versa.

Complexity: Constant

Throws: Nothing.


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