alternative Standard Libary  0.29.8
std::list< T, TAllocator > Template-Klassenreferenz

#include <list.hpp>

Öffentliche Typen

typedef T value_type
 
typedef TAllocator allocator_type
 
typedef int size_type
 
typedef node_iterator< node *, T *, T & > iterator
 
typedef node_iterator< const node *, const T *, const T & > const_iterator
 

Öffentliche Methoden

 list (const allocator_type &allocator=allocator_type())
 
template<class InputIterator >
 list (InputIterator first, InputIterator last, const allocator_type &allocator=allocator_type())
 
 list (const list &rhs, const allocator_type &allocator=allocator_type())
 
 ~list ()
 
listoperator= (const list &rhs)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
const T & front () const
 
T & front ()
 
const T & back () const
 
T & back ()
 
void push_front (const T &value)
 
void pop_front ()
 
void push_back (const T &value)
 
void pop_back ()
 
iterator insert (iterator pos, const T &value)
 
iterator erase (iterator it)
 
iterator erase (iterator first, iterator last)
 
template<class InputIterator >
void assign (InputIterator first, InputIterator last)
 
bool empty () const
 
void clear ()
 
size_type size () const
 
const allocator_typeget_allocator () const
 
void set_allocator (const allocator_type &allocator)
 

Statische öffentliche Attribute

static const size_t kNodeSize = sizeof(node)
 

Ausführliche Beschreibung

template<typename T, class TAllocator = std::allocator>
class std::list< T, TAllocator >

Dokumentation der benutzerdefinierten Datentypen

◆ allocator_type

template<typename T, class TAllocator = std::allocator>
typedef TAllocator std::list< T, TAllocator >::allocator_type

◆ const_iterator

template<typename T, class TAllocator = std::allocator>
typedef node_iterator<const node*, const T*, const T&> std::list< T, TAllocator >::const_iterator

◆ iterator

template<typename T, class TAllocator = std::allocator>
typedef node_iterator<node*, T*, T&> std::list< T, TAllocator >::iterator

◆ size_type

template<typename T, class TAllocator = std::allocator>
typedef int std::list< T, TAllocator >::size_type

◆ value_type

template<typename T, class TAllocator = std::allocator>
typedef T std::list< T, TAllocator >::value_type

Beschreibung der Konstruktoren und Destruktoren

◆ list() [1/3]

template<typename T, class TAllocator = std::allocator>
std::list< T, TAllocator >::list ( const allocator_type allocator = allocator_type())
inlineexplicit
150  : m_allocator(allocator)
151  {
152  m_root.reset();
153  }

◆ list() [2/3]

template<typename T, class TAllocator = std::allocator>
template<class InputIterator >
std::list< T, TAllocator >::list ( InputIterator  first,
InputIterator  last,
const allocator_type allocator = allocator_type() 
)
inline
155  : m_allocator(allocator)
156  {
157  m_root.reset();
158  assign(first, last);
159  }
void assign(InputIterator first, InputIterator last)
Definition: list.hpp:265

◆ list() [3/3]

template<typename T, class TAllocator = std::allocator>
std::list< T, TAllocator >::list ( const list< T, TAllocator > &  rhs,
const allocator_type allocator = allocator_type() 
)
inline
161  : m_allocator(allocator)
162  {
163  m_root.reset();
164  assign(rhs.begin(), rhs.end());
165  }
void assign(InputIterator first, InputIterator last)
Definition: list.hpp:265

◆ ~list()

template<typename T, class TAllocator = std::allocator>
std::list< T, TAllocator >::~list ( )
inline
167  {
168  clear();
169  }
void clear()
Definition: list.hpp:280

Dokumentation der Elementfunktionen

◆ assign()

template<typename T, class TAllocator = std::allocator>
template<class InputIterator >
void std::list< T, TAllocator >::assign ( InputIterator  first,
InputIterator  last 
)
inline
266  {
267  clear();
268  while (first != last)
269  {
270  push_back(*first);
271  ++first;
272  }
273  }
void clear()
Definition: list.hpp:280
void push_back(const T &value)
Definition: list.hpp:229

◆ back() [1/2]

template<typename T, class TAllocator = std::allocator>
const T& std::list< T, TAllocator >::back ( ) const
inline
208  {
209  assert(!empty()); return upcast(m_root.prev)->value;
210  }
bool empty() const
Definition: list.hpp:275

◆ back() [2/2]

template<typename T, class TAllocator = std::allocator>
T& std::list< T, TAllocator >::back ( )
inline
212  {
213  assert(!empty()); return upcast(m_root.prev)->value;
214  }
bool empty() const
Definition: list.hpp:275

◆ begin() [1/2]

template<typename T, class TAllocator = std::allocator>
iterator std::list< T, TAllocator >::begin ( )
inline
181  {
182  return iterator(upcast(m_root.next));
183  }
node_iterator< node *, T *, T & > iterator
Definition: list.hpp:145

◆ begin() [2/2]

template<typename T, class TAllocator = std::allocator>
const_iterator std::list< T, TAllocator >::begin ( ) const
inline
185  {
186  return const_iterator(upcast(m_root.next));
187  }
node_iterator< const node *, const T *, const T & > const_iterator
Definition: list.hpp:146

◆ clear()

template<typename T, class TAllocator = std::allocator>
void std::list< T, TAllocator >::clear ( )
inline
281  {
282  node* it = upcast(m_root.next);
283  while (it != &m_root)
284  {
285  node* nextIt = upcast(it->next);
286  destruct_node(it);
287  it = nextIt;
288  }
289  m_root.reset();
290  }

◆ empty()

template<typename T, class TAllocator = std::allocator>
bool std::list< T, TAllocator >::empty ( ) const
inline
276  {
277  return !m_root.in_list();
278  }

◆ end() [1/2]

template<typename T, class TAllocator = std::allocator>
iterator std::list< T, TAllocator >::end ( )
inline
189  {
190  return iterator(&m_root);
191  }
node_iterator< node *, T *, T & > iterator
Definition: list.hpp:145

◆ end() [2/2]

template<typename T, class TAllocator = std::allocator>
const_iterator std::list< T, TAllocator >::end ( ) const
inline
193  {
194  return const_iterator(&m_root);
195  }
node_iterator< const node *, const T *, const T & > const_iterator
Definition: list.hpp:146

◆ erase() [1/2]

template<typename T, class TAllocator = std::allocator>
iterator std::list< T, TAllocator >::erase ( iterator  it)
inline
249  {
250  assert(it.node()->in_list());
251  iterator itErase(it);
252  ++it;
253  itErase.node()->unlink();
254  destruct_node(itErase.node());
255  return it;
256  }
node_iterator< node *, T *, T & > iterator
Definition: list.hpp:145

◆ erase() [2/2]

template<typename T, class TAllocator = std::allocator>
iterator std::list< T, TAllocator >::erase ( iterator  first,
iterator  last 
)
inline
258  {
259  while (first != last)
260  first = erase(first);
261  return first;
262  }
iterator erase(iterator it)
Definition: list.hpp:248

◆ front() [1/2]

template<typename T, class TAllocator = std::allocator>
const T& std::list< T, TAllocator >::front ( ) const
inline
198  {
199  assert(!empty());
200  return upcast(m_root.next)->value;
201  }
bool empty() const
Definition: list.hpp:275

◆ front() [2/2]

template<typename T, class TAllocator = std::allocator>
T& std::list< T, TAllocator >::front ( )
inline
203  {
204  assert(!empty());
205  return upcast(m_root.next)->value;
206  }
bool empty() const
Definition: list.hpp:275

◆ get_allocator()

template<typename T, class TAllocator = std::allocator>
const allocator_type& std::list< T, TAllocator >::get_allocator ( ) const
inline
305  {
306  return m_allocator;
307  }

◆ insert()

template<typename T, class TAllocator = std::allocator>
iterator std::list< T, TAllocator >::insert ( iterator  pos,
const T &  value 
)
inline
243  {
244  node* newNode = construct_node(value);
245  newNode->link_before(pos.node());
246  return iterator(newNode);
247  }
node_iterator< node *, T *, T & > iterator
Definition: list.hpp:145

◆ operator=()

template<typename T, class TAllocator = std::allocator>
list& std::list< T, TAllocator >::operator= ( const list< T, TAllocator > &  rhs)
inline
172  {
173  if (this != &rhs)
174  {
175  assign(rhs.begin(), rhs.end());
176  }
177  return *this;
178  }
void assign(InputIterator first, InputIterator last)
Definition: list.hpp:265

◆ pop_back()

template<typename T, class TAllocator = std::allocator>
void std::list< T, TAllocator >::pop_back ( )
inline
235  {
236  assert(!empty());
237  node* backNode = upcast(m_root.prev);
238  backNode->unlink();
239  destruct_node(backNode);
240  }
bool empty() const
Definition: list.hpp:275

◆ pop_front()

template<typename T, class TAllocator = std::allocator>
void std::list< T, TAllocator >::pop_front ( )
inline
222  {
223  assert(!empty());
224  node* frontNode = upcast(m_root.next);
225  frontNode->unlink();
226  destruct_node(frontNode);
227  }
bool empty() const
Definition: list.hpp:275

◆ push_back()

template<typename T, class TAllocator = std::allocator>
void std::list< T, TAllocator >::push_back ( const T &  value)
inline
230  {
231  node* newNode = construct_node(value);
232  newNode->link_before(&m_root);
233  }

◆ push_front()

template<typename T, class TAllocator = std::allocator>
void std::list< T, TAllocator >::push_front ( const T &  value)
inline
217  {
218  node* newNode = construct_node(value);
219  newNode->link_before(m_root.next);
220  }

◆ set_allocator()

template<typename T, class TAllocator = std::allocator>
void std::list< T, TAllocator >::set_allocator ( const allocator_type allocator)
inline
309  {
310  m_allocator = allocator;
311  }

◆ size()

template<typename T, class TAllocator = std::allocator>
size_type std::list< T, TAllocator >::size ( ) const
inline
293  {
294  const node* it = upcast(m_root.next);
295  size_type size(0);
296  while (it != &m_root)
297  {
298  ++size;
299  it = upcast(it->next);
300  }
301  return size;
302  }
int size_type
Definition: list.hpp:144
size_type size() const
Definition: list.hpp:292

Dokumentation der Datenelemente

◆ kNodeSize

template<typename T, class TAllocator = std::allocator>
const size_t std::list< T, TAllocator >::kNodeSize = sizeof(node)
static

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: