Nugget
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
eastl::slist< T, Allocator > Class Template Reference

#include <slist.h>

Inheritance diagram for eastl::slist< T, Allocator >:
Inheritance graph
[legend]
Collaboration diagram for eastl::slist< T, Allocator >:
Collaboration graph
[legend]

Public Types

typedef T value_type
 
typedef value_type * pointer
 
typedef const value_type * const_pointer
 
typedef value_type & reference
 
typedef const value_type & const_reference
 
typedef SListIterator< T, T *, T & > iterator
 
typedef SListIterator< T, const T *, const T & > const_iterator
 
typedef base_type::size_type size_type
 
typedef base_type::difference_type difference_type
 
typedef base_type::allocator_type allocator_type
 
typedef base_type::node_type node_type
 
typedef base_type::base_node_type base_node_type
 
- Public Types inherited from eastl::SListBase< T, EASTLAllocatorType >
typedef EASTLAllocatorType allocator_type
 
typedef SListNode< T > node_type
 
typedef eastl_size_t size_type
 
typedef ptrdiff_t difference_type
 
typedef SListNodeBase base_node_type
 

Public Member Functions

 slist (const allocator_type &allocator)
 
 slist (size_type n, const allocator_type &allocator=EASTL_SLIST_DEFAULT_ALLOCATOR)
 
 slist (size_type n, const value_type &value, const allocator_type &allocator=EASTL_SLIST_DEFAULT_ALLOCATOR)
 
 slist (const this_type &x)
 
 slist (std::initializer_list< value_type > ilist, const allocator_type &allocator=EASTL_SLIST_DEFAULT_ALLOCATOR)
 
 slist (this_type &&x)
 
 slist (this_type &&x, const allocator_type &allocator)
 
template<typename InputIterator >
 slist (InputIterator first, InputIterator last)
 
this_typeoperator= (const this_type &x)
 
this_typeoperator= (std::initializer_list< value_type >)
 
this_typeoperator= (this_type &&x)
 
void swap (this_type &x)
 
void assign (size_type n, const value_type &value)
 
void assign (std::initializer_list< value_type > ilist)
 
template<typename InputIterator >
void assign (InputIterator first, InputIterator last)
 
iterator begin () EA_NOEXCEPT
 
const_iterator begin () const EA_NOEXCEPT
 
const_iterator cbegin () const EA_NOEXCEPT
 
iterator end () EA_NOEXCEPT
 
const_iterator end () const EA_NOEXCEPT
 
const_iterator cend () const EA_NOEXCEPT
 
iterator before_begin () EA_NOEXCEPT
 
const_iterator before_begin () const EA_NOEXCEPT
 
const_iterator cbefore_begin () const EA_NOEXCEPT
 
iterator previous (const_iterator position)
 
const_iterator previous (const_iterator position) const
 
reference front ()
 
const_reference front () const
 
template<class... Args>
void emplace_front (Args &&... args)
 
void push_front (const value_type &value)
 
reference push_front ()
 
void push_front (value_type &&value)
 
void pop_front ()
 
bool empty () const EA_NOEXCEPT
 
size_type size () const EA_NOEXCEPT
 
void resize (size_type n, const value_type &value)
 
void resize (size_type n)
 
iterator insert (const_iterator position)
 
iterator insert (const_iterator position, const value_type &value)
 
void insert (const_iterator position, size_type n, const value_type &value)
 
template<typename InputIterator >
void insert (const_iterator position, InputIterator first, InputIterator last)
 
iterator insert_after (const_iterator position)
 
iterator insert_after (const_iterator position, const value_type &value)
 
iterator insert_after (const_iterator position, size_type n, const value_type &value)
 
iterator insert_after (const_iterator position, std::initializer_list< value_type > ilist)
 
iterator insert_after (const_iterator position, value_type &&value)
 
template<class... Args>
iterator emplace_after (const_iterator position, Args &&... args)
 
template<typename InputIterator >
iterator insert_after (const_iterator position, InputIterator first, InputIterator last)
 
iterator erase (const_iterator position)
 
iterator erase (const_iterator first, const_iterator last)
 
iterator erase_after (const_iterator position)
 
iterator erase_after (const_iterator before_first, const_iterator last)
 
void clear () EA_NOEXCEPT
 
void reset_lose_memory () EA_NOEXCEPT
 
void remove (const value_type &value)
 
template<typename Predicate >
void remove_if (Predicate predicate)
 
void reverse () EA_NOEXCEPT
 
void splice (const_iterator position, this_type &x)
 
void splice (const_iterator position, this_type &x, const_iterator i)
 
void splice (const_iterator position, this_type &x, const_iterator first, const_iterator last)
 
void splice (const_iterator position, this_type &&x)
 
void splice (const_iterator position, this_type &&x, const_iterator i)
 
void splice (const_iterator position, this_type &&x, const_iterator first, const_iterator last)
 
void splice_after (const_iterator position, this_type &x)
 
void splice_after (const_iterator position, this_type &x, const_iterator i)
 
void splice_after (const_iterator position, this_type &x, const_iterator first, const_iterator last)
 
void splice_after (const_iterator position, this_type &&x)
 
void splice_after (const_iterator position, this_type &&x, const_iterator i)
 
void splice_after (const_iterator position, this_type &&x, const_iterator first, const_iterator last)
 
void splice_after (const_iterator position, const_iterator before_first, const_iterator before_last)
 
void splice_after (const_iterator position, const_iterator previous)
 
void sort ()
 
template<class Compare >
void sort (Compare compare)
 
bool validate () const
 
int validate_iterator (const_iterator i) const
 
SListNodeBaseDoEraseAfter (SListNodeBase *pNode)
 
SListNodeBaseDoEraseAfter (SListNodeBase *pNode, SListNodeBase *pNodeLast)
 
node_typeDoAllocateNode ()
 
void DoFreeNode (node_type *pNode)
 
base_node_typeinternalNode () EA_NOEXCEPT
 
base_node_type const & internalNode () const EA_NOEXCEPT
 
allocator_type & internalAllocator () EA_NOEXCEPT
 
const allocator_type & internalAllocator () const EA_NOEXCEPT
 
- Public Member Functions inherited from eastl::SListBase< T, EASTLAllocatorType >
const allocator_type & get_allocator () const EA_NOEXCEPT
 
allocator_type & get_allocator () EA_NOEXCEPT
 
void set_allocator (const allocator_type &allocator)
 

Public Attributes

eastl::compressed_pair< base_node_type, allocator_type > mNodeAllocator
 

Protected Member Functions

node_typeDoCreateNode ()
 
template<typename... Args>
node_typeDoCreateNode (Args &&... args)
 
template<typename Integer >
void DoAssign (Integer n, Integer value, true_type)
 
template<typename InputIterator >
void DoAssign (InputIterator first, InputIterator last, false_type)
 
void DoAssignValues (size_type n, const value_type &value)
 
template<typename InputIterator >
node_typeDoInsertAfter (SListNodeBase *pNode, InputIterator first, InputIterator last)
 
template<typename Integer >
node_typeDoInsertAfter (SListNodeBase *pNode, Integer n, Integer value, true_type)
 
template<typename InputIterator >
node_typeDoInsertAfter (SListNodeBase *pNode, InputIterator first, InputIterator last, false_type)
 
node_typeDoInsertValueAfter (SListNodeBase *pNode)
 
node_typeDoInsertValuesAfter (SListNodeBase *pNode, size_type n, const value_type &value)
 
template<typename... Args>
node_typeDoInsertValueAfter (SListNodeBase *pNode, Args &&... args)
 
void DoSwap (this_type &x)
 
- Protected Member Functions inherited from eastl::SListBase< T, EASTLAllocatorType >
base_node_typeinternalNode () EA_NOEXCEPT
 
base_node_type const & internalNode () const EA_NOEXCEPT
 
allocator_type & internalAllocator () EA_NOEXCEPT
 
const allocator_type & internalAllocator () const EA_NOEXCEPT
 
 SListBase (const allocator_type &a)
 
node_typeDoAllocateNode ()
 
void DoFreeNode (node_type *pNode)
 
SListNodeBaseDoEraseAfter (SListNodeBase *pNode)
 
SListNodeBaseDoEraseAfter (SListNodeBase *pNode, SListNodeBase *pNodeLast)
 

Additional Inherited Members

- Protected Attributes inherited from eastl::SListBase< T, EASTLAllocatorType >
eastl::compressed_pair< base_node_type, allocator_type > mNodeAllocator
 

Detailed Description

template<typename T, typename Allocator = EASTLAllocatorType>
class eastl::slist< T, Allocator >

slist

This is the equivalent of C++11's forward_list.

– size() is O(n) – Note that as of this writing, list::size() is an O(n) operation when EASTL_SLIST_SIZE_CACHE is disabled. That is, getting the size of the list is not a fast operation, as it requires traversing the list and counting the nodes. We could make list::size() be fast by having a member mSize variable. There are reasons for having such functionality and reasons for not having such functionality. We currently choose to not have a member mSize variable as it would add four bytes to the class, add a tiny amount of processing to functions such as insert and erase, and would only serve to improve the size function, but no others. The alternative argument is that the C++ standard states that std::list should be an O(1) operation (i.e. have a member size variable), most C++ standard library list implementations do so, the size is but an integer which is quick to update, and many users expect to have a fast size function. The EASTL_SLIST_SIZE_CACHE option changes this. To consider: Make size caching an optional template parameter.

Pool allocation If you want to make a custom memory pool for a list container, your pool needs to contain items of type slist::node_type. So if you have a memory pool that has a constructor that takes the size of pool items and the count of pool items, you would do this (assuming that MemoryPool implements the Allocator interface): typedef slist<Widget, MemoryPool> WidgetList; // Delare your WidgetList type. MemoryPool myPool(sizeof(WidgetList::node_type), 100); // Make a pool of 100 Widget nodes. WidgetList myList(&myPool); // Create a list that uses the pool.


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