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

#include <slist.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

 slist (const allocator_type &allocator=allocator_type())
 
template<class InputIterator >
 slist (InputIterator first, InputIterator last, const allocator_type &allocator=allocator_type())
 
 slist (const slist &rhs, const allocator_type &allocator=allocator_type())
 
 ~slist ()
 
slistoperator= (const slist &rhs)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
const T & front () const
 
T & front ()
 
void push_front (const T &value)
 
void pop_front ()
 
void insert_after (iterator pos, const T &value)
 
template<class InputIterator >
void assign (InputIterator first, InputIterator last)
 
void clear ()
 
bool empty () const
 
size_type size () const
 

Öffentliche, statische Methoden

static iterator previous (iterator nextIt)
 
static const_iterator previous (const_iterator nextIt)
 

Statische öffentliche Attribute

static const size_t kNodeSize = sizeof(node)
 

Ausführliche Beschreibung

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

Dokumentation der benutzerdefinierten Datentypen

◆ allocator_type

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

◆ const_iterator

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

◆ iterator

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

◆ size_type

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

◆ value_type

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

Beschreibung der Konstruktoren und Destruktoren

◆ slist() [1/3]

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

◆ slist() [2/3]

template<typename T , class TAllocator = std::allocator>
template<class InputIterator >
std::slist< T, TAllocator >::slist ( 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: slist.hpp:226

◆ slist() [3/3]

template<typename T , class TAllocator = std::allocator>
std::slist< T, TAllocator >::slist ( const slist< 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: slist.hpp:226

◆ ~slist()

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

Dokumentation der Elementfunktionen

◆ assign()

template<typename T , class TAllocator = std::allocator>
template<class InputIterator >
void std::slist< T, TAllocator >::assign ( InputIterator  first,
InputIterator  last 
)
inline
227  {
228  clear();
229  iterator it(&m_root);
230  while (first != last)
231  {
232  insert_after(it, *first);
233  ++it;
234  ++first;
235  }
236  }
node_iterator< node *, T *, T & > iterator
Definition: slist.hpp:145
void clear()
Definition: slist.hpp:238
void insert_after(iterator pos, const T &value)
Definition: slist.hpp:220

◆ begin() [1/2]

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

◆ begin() [2/2]

template<typename T , class TAllocator = std::allocator>
const_iterator std::slist< 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: slist.hpp:146

◆ clear()

template<typename T , class TAllocator = std::allocator>
void std::slist< T, TAllocator >::clear ( )
inline
239  {
240  node* it = upcast(m_root.next);
241  while (it != &m_root)
242  {
243  node* nextIt = upcast(it->next);
244  destruct_node(it);
245  it = nextIt;
246  }
247  m_root.reset();
248  }

◆ empty()

template<typename T , class TAllocator = std::allocator>
bool std::slist< T, TAllocator >::empty ( ) const
inline
250  {
251  return !m_root.in_list();
252  }

◆ end() [1/2]

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

◆ end() [2/2]

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

◆ front() [1/2]

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

◆ front() [2/2]

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

◆ insert_after()

template<typename T , class TAllocator = std::allocator>
void std::slist< T, TAllocator >::insert_after ( iterator  pos,
const T &  value 
)
inline
221  {
222  node* newNode = construct_node(value);
223  newNode->link_after(pos.node());
224  }

◆ operator=()

template<typename T , class TAllocator = std::allocator>
slist& std::slist< T, TAllocator >::operator= ( const slist< 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: slist.hpp:226

◆ pop_front()

template<typename T , class TAllocator = std::allocator>
void std::slist< T, TAllocator >::pop_front ( )
inline
214  {
215  assert(!empty());
216  node* n = upcast(m_root.next);
217  n->unlink(&m_root);
218  destruct_node(n);
219  }
bool empty() const
Definition: slist.hpp:249

◆ previous() [1/2]

template<typename T , class TAllocator = std::allocator>
static iterator std::slist< T, TAllocator >::previous ( iterator  nextIt)
inlinestatic
268  {
269  assert(nextIt.node()->in_list());
270  iterator prevIt = nextIt;
271  while (nextIt.node() != prevIt.next())
272  ++prevIt;
273  return prevIt;
274  }
node_iterator< node *, T *, T & > iterator
Definition: slist.hpp:145

◆ previous() [2/2]

template<typename T , class TAllocator = std::allocator>
static const_iterator std::slist< T, TAllocator >::previous ( const_iterator  nextIt)
inlinestatic
276  {
277  assert(nextIt.node()->in_list());
278  const_iterator prevIt = nextIt;
279  while (nextIt.node() != prevIt.next())
280  ++prevIt;
281  return prevIt;
282  }
node_iterator< const node *, const T *, const T & > const_iterator
Definition: slist.hpp:146

◆ push_front()

template<typename T , class TAllocator = std::allocator>
void std::slist< T, TAllocator >::push_front ( const T &  value)
inline
209  {
210  node* newNode = construct_node(value);
211  newNode->link_after(&m_root);
212  }

◆ size()

template<typename T , class TAllocator = std::allocator>
size_type std::slist< T, TAllocator >::size ( ) const
inline
255  {
256  const node* it = upcast(m_root.next);
257  size_type size(0);
258  while (it != &m_root)
259  {
260  ++size;
261  it = upcast(it->next);
262  }
263  return size;
264  }
int size_type
Definition: slist.hpp:144
size_type size() const
Definition: slist.hpp:254

Dokumentation der Datenelemente

◆ kNodeSize

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

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