Nugget
Public Types | Public Member Functions | Static Public Member Functions | List of all members
eastl::intrusive_list< T > Class Template Reference

#include <intrusive_list.h>

Inheritance diagram for eastl::intrusive_list< T >:
Inheritance graph
[legend]
Collaboration diagram for eastl::intrusive_list< T >:
Collaboration graph
[legend]

Public Types

typedef intrusive_list< T > this_type
 
typedef intrusive_list_base base_type
 
typedef T node_type
 
typedef T value_type
 
typedef base_type::size_type size_type
 
typedef base_type::difference_type difference_type
 
typedef T & reference
 
typedef const T & const_reference
 
typedef T * pointer
 
typedef const T * const_pointer
 
typedef intrusive_list_iterator< T, T *, T & > iterator
 
typedef intrusive_list_iterator< T, const T *, const T & > const_iterator
 
typedef eastl::reverse_iterator< iteratorreverse_iterator
 
typedef eastl::reverse_iterator< const_iteratorconst_reverse_iterator
 
- Public Types inherited from eastl::intrusive_list_base
typedef eastl_size_t size_type
 
typedef ptrdiff_t difference_type
 

Public Member Functions

 intrusive_list ()
 Creates an empty list.
 
 intrusive_list (const this_type &x)
 Creates an empty list; ignores the argument.
 
this_typeoperator= (const this_type &x)
 Clears the list; ignores the argument.
 
void swap (this_type &)
 Swaps the contents of two intrusive lists; O(1).
 
iterator begin () EA_NOEXCEPT
 Returns an iterator pointing to the first element in the list.
 
const_iterator begin () const EA_NOEXCEPT
 Returns a const_iterator pointing to the first element in the list.
 
const_iterator cbegin () const EA_NOEXCEPT
 Returns a const_iterator pointing to the first element in the list.
 
iterator end () EA_NOEXCEPT
 Returns an iterator pointing one-after the last element in the list.
 
const_iterator end () const EA_NOEXCEPT
 Returns a const_iterator pointing one-after the last element in the list.
 
const_iterator cend () const EA_NOEXCEPT
 Returns a const_iterator pointing one-after the last element in the list.
 
reverse_iterator rbegin () EA_NOEXCEPT
 Returns a reverse_iterator pointing at the end of the list (start of the reverse sequence).
 
const_reverse_iterator rbegin () const EA_NOEXCEPT
 Returns a const_reverse_iterator pointing at the end of the list (start of the reverse sequence).
 
const_reverse_iterator crbegin () const EA_NOEXCEPT
 Returns a const_reverse_iterator pointing at the end of the list (start of the reverse sequence).
 
reverse_iterator rend () EA_NOEXCEPT
 Returns a reverse_iterator pointing at the start of the list (end of the reverse sequence).
 
const_reverse_iterator rend () const EA_NOEXCEPT
 Returns a const_reverse_iterator pointing at the start of the list (end of the reverse sequence).
 
const_reverse_iterator crend () const EA_NOEXCEPT
 Returns a const_reverse_iterator pointing at the start of the list (end of the reverse sequence).
 
reference front ()
 Returns a reference to the first element. The list must be non-empty.
 
const_reference front () const
 Returns a const reference to the first element. The list must be non-empty.
 
reference back ()
 Returns a reference to the last element. The list must be non-empty.
 
const_reference back () const
 Returns a const reference to the last element. The list must be non-empty.
 
void push_front (value_type &x)
 Adds an element to the front of the list; O(1). The element is not copied. The element must not be in any other list.
 
void push_back (value_type &x)
 Adds an element to the back of the list; O(1). The element is not copied. The element must not be in any other list.
 
bool contains (const value_type &x) const
 Returns true if the given element is in the list; O(n). Equivalent to (locate(x) != end()).
 
iterator locate (value_type &x)
 Converts a reference to an object in the list back to an iterator, or returns end() if it is not part of the list. O(n)
 
const_iterator locate (const value_type &x) const
 Converts a const reference to an object in the list back to a const iterator, or returns end() if it is not part of the list. O(n)
 
iterator insert (const_iterator pos, value_type &x)
 Inserts an element before the element pointed to by the iterator. O(1)
 
iterator erase (const_iterator pos)
 Erases the element pointed to by the iterator. O(1)
 
iterator erase (const_iterator pos, const_iterator last)
 Erases elements within the iterator range [pos, last). O(1)
 
reverse_iterator erase (const_reverse_iterator pos)
 
reverse_iterator erase (const_reverse_iterator pos, const_reverse_iterator last)
 
void splice (const_iterator pos, value_type &x)
 
void splice (const_iterator pos, intrusive_list &x)
 
void splice (const_iterator pos, intrusive_list &x, const_iterator i)
 
void splice (const_iterator pos, intrusive_list &x, const_iterator first, const_iterator last)
 
void merge (this_type &x)
 
template<typename Compare >
void merge (this_type &x, Compare compare)
 
void unique ()
 
template<typename BinaryPredicate >
void unique (BinaryPredicate)
 
void sort ()
 
template<typename Compare >
void sort (Compare compare)
 
int validate_iterator (const_iterator i) const
 
- Public Member Functions inherited from eastl::intrusive_list_base
bool empty () const EA_NOEXCEPT
 
eastl_size_t size () const EA_NOEXCEPT
 Returns the number of elements in the list; O(n).
 
void clear () EA_NOEXCEPT
 Clears the list; O(1). No deallocation occurs.
 
void pop_front ()
 Removes an element from the front of the list; O(1). The element must exist, but is not deallocated.
 
void pop_back ()
 Removes an element from the back of the list; O(1). The element must exist, but is not deallocated.
 
EASTL_API void reverse () EA_NOEXCEPT
 Reverses a list so that front and back are swapped; O(n).
 
EASTL_API bool validate () const
 Scans a list for linkage inconsistencies; O(n) time, O(1) space. Returns false if errors are detected, such as loops or branching.
 

Static Public Member Functions

static void remove (value_type &value)
 Erases an element from a list; O(1). Note that this is static so you don't need to know which list the element, although it must be in some list.
 

Additional Inherited Members

- Protected Attributes inherited from eastl::intrusive_list_base
intrusive_list_node mAnchor
 Sentinel node (end). All data nodes are linked in a ring from this node.
 

Detailed Description

template<typename T = intrusive_list_node>
class eastl::intrusive_list< T >

intrusive_list

Example usage: struct IntNode : public eastl::intrusive_list_node { int mX; IntNode(int x) : mX(x) { } };

IntNode nodeA(0); IntNode nodeB(1);

intrusive_list<IntNode> intList; intList.push_back(nodeA); intList.push_back(nodeB); intList.remove(nodeA);

Member Function Documentation

◆ splice() [1/4]

template<typename T >
void eastl::intrusive_list< T >::splice ( const_iterator  pos,
intrusive_list< T > &  x 
)

Moves the contents of a list into this list before the element pointed to by pos; O(1). Required: &x != this (same as std::list).

◆ splice() [2/4]

template<typename T >
void eastl::intrusive_list< T >::splice ( const_iterator  pos,
intrusive_list< T > &  x,
const_iterator  first,
const_iterator  last 
)

Moves the range of elements [first, last) from list x into the current list before the element pointed to by pos; O(1). Required: pos must not be in [first, last). (same as std::list).

◆ splice() [3/4]

template<typename T >
void eastl::intrusive_list< T >::splice ( const_iterator  pos,
intrusive_list< T > &  x,
const_iterator  i 
)

Moves the given element pointed to i within the list x into the current list before the element pointed to by pos; O(1).

◆ splice() [4/4]

template<typename T >
void eastl::intrusive_list< T >::splice ( const_iterator  pos,
value_type &  x 
)

Moves the given element into this list before the element pointed to by pos; O(1). Required: x must be in some list or have first/next pointers that point it itself.


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