alternative Standard Libary  0.29.8
std::fixed_list< T, TCapacity > Template-Klassenreferenz

#include <fixed_list.hpp>

Öffentliche Typen

using index_type = index_type_selector::index_type
 
using value_type = T
 
using size_type = int
 
using iterator = node_iterator< node *, T *, T & >
 
using const_iterator = node_iterator< const node *, const T *, const T & >
 

Öffentliche Methoden

 fixed_list ()
 
template<class InputIterator >
 fixed_list (InputIterator first, InputIterator last)
 
 fixed_list (const fixed_list &rhs)
 
 fixed_list (e_noinitialize)
 
 ~fixed_list ()
 
fixed_listoperator= (const fixed_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)
 
void clear ()
 
bool empty () const
 
size_type size () const
 

Ausführliche Beschreibung

template<typename T, size_t TCapacity>
class std::fixed_list< T, TCapacity >

Dokumentation der benutzerdefinierten Datentypen

◆ const_iterator

template<typename T , size_t TCapacity>
using std::fixed_list< T, TCapacity >::const_iterator = node_iterator<const node*, const T*, const T&>

◆ index_type

template<typename T , size_t TCapacity>
using std::fixed_list< T, TCapacity >::index_type = index_type_selector::index_type

◆ iterator

template<typename T , size_t TCapacity>
using std::fixed_list< T, TCapacity >::iterator = node_iterator<node*, T*, T&>

◆ size_type

template<typename T , size_t TCapacity>
using std::fixed_list< T, TCapacity >::size_type = int

◆ value_type

template<typename T , size_t TCapacity>
using std::fixed_list< T, TCapacity >::value_type = T

Beschreibung der Konstruktoren und Destruktoren

◆ fixed_list() [1/4]

template<typename T , size_t TCapacity>
std::fixed_list< T, TCapacity >::fixed_list ( )
inline
132  : m_num_nodes(0) {
133  init_free_indices();
134  get_root()->reset();
135  }

◆ fixed_list() [2/4]

template<typename T , size_t TCapacity>
template<class InputIterator >
std::fixed_list< T, TCapacity >::fixed_list ( InputIterator  first,
InputIterator  last 
)
inline
137  {
138  get_root()->reset();
139  assign(first, last);
140  }
void assign(InputIterator first, InputIterator last)
Definition: fixed_list.hpp:237

◆ fixed_list() [3/4]

template<typename T , size_t TCapacity>
std::fixed_list< T, TCapacity >::fixed_list ( const fixed_list< T, TCapacity > &  rhs)
inline
141  {
142  get_root()->reset();
143  copy(rhs, int_to_type<has_trivial_copy<T>::value>());
144  }

◆ fixed_list() [4/4]

template<typename T , size_t TCapacity>
std::fixed_list< T, TCapacity >::fixed_list ( e_noinitialize  )
inlineexplicit
145  {
146  }

◆ ~fixed_list()

template<typename T , size_t TCapacity>
std::fixed_list< T, TCapacity >::~fixed_list ( )
inline
148  {
149  clear();
150  }
void clear()
Definition: fixed_list.hpp:244

Dokumentation der Elementfunktionen

◆ assign()

template<typename T , size_t TCapacity>
template<class InputIterator >
void std::fixed_list< T, TCapacity >::assign ( InputIterator  first,
InputIterator  last 
)
inline
237  {
238  clear();
239  while (first != last) {
240  push_back(*first);
241  ++first;
242  }
243  }
void clear()
Definition: fixed_list.hpp:244
void push_back(const T &value)
Definition: fixed_list.hpp:192

◆ back() [1/2]

template<typename T , size_t TCapacity>
const T& std::fixed_list< T, TCapacity >::back ( ) const
inline
172  { assert(!empty()); return get_prev(get_root())->value; }
bool empty() const
Definition: fixed_list.hpp:257

◆ back() [2/2]

template<typename T , size_t TCapacity>
T& std::fixed_list< T, TCapacity >::back ( )
inline
174  { assert(!empty()); return get_prev(get_root())->value; }
bool empty() const
Definition: fixed_list.hpp:257

◆ begin() [1/2]

template<typename T , size_t TCapacity>
iterator std::fixed_list< T, TCapacity >::begin ( )
inline
160  { return iterator(get_next(get_root()), this); }
node_iterator< node *, T *, T & > iterator
Definition: fixed_list.hpp:129

◆ begin() [2/2]

template<typename T , size_t TCapacity>
const_iterator std::fixed_list< T, TCapacity >::begin ( ) const
inline
162  { return const_iterator(get_next(get_root()), this); }
node_iterator< const node *, const T *, const T & > const_iterator
Definition: fixed_list.hpp:130

◆ clear()

template<typename T , size_t TCapacity>
void std::fixed_list< T, TCapacity >::clear ( )
inline
244  {
245  node* root = get_root();
246  node* iter = get_next(root);
247  while (iter != root) {
248  node* next = get_next(iter);
249  destruct_node(iter);
250  iter = next;
251  }
252  root->reset();
253  m_num_nodes = 0;
254  init_free_indices();
255  }

◆ empty()

template<typename T , size_t TCapacity>
bool std::fixed_list< T, TCapacity >::empty ( ) const
inline
258  { return m_num_nodes == 0; }

◆ end() [1/2]

template<typename T , size_t TCapacity>
iterator std::fixed_list< T, TCapacity >::end ( )
inline
164  { return iterator(get_root(), this); }
node_iterator< node *, T *, T & > iterator
Definition: fixed_list.hpp:129

◆ end() [2/2]

template<typename T , size_t TCapacity>
const_iterator std::fixed_list< T, TCapacity >::end ( ) const
inline
166  { return const_iterator(get_root(), this); }
node_iterator< const node *, const T *, const T & > const_iterator
Definition: fixed_list.hpp:130

◆ erase() [1/2]

template<typename T , size_t TCapacity>
iterator std::fixed_list< T, TCapacity >::erase ( iterator  it)
inline
217  {
218  assert(!empty());
219  assert(it.node()->in_list());
220  assert(it.list() == this);
221  iterator it_erase(it);
222  ++it;
223  node* erase_node = it_erase.node();
224  m_free_indices[++m_free_index_top] = erase_node->index;
225  unlink(erase_node);
226  destruct_node(erase_node);
227  --m_num_nodes;
228  return it;
229  }
bool empty() const
Definition: fixed_list.hpp:257
node_iterator< node *, T *, T & > iterator
Definition: fixed_list.hpp:129

◆ erase() [2/2]

template<typename T , size_t TCapacity>
iterator std::fixed_list< T, TCapacity >::erase ( iterator  first,
iterator  last 
)
inline
230  {
231  while (first != last)
232  first = erase(first);
233  return first;
234  }
iterator erase(iterator it)
Definition: fixed_list.hpp:217

◆ front() [1/2]

template<typename T , size_t TCapacity>
const T& std::fixed_list< T, TCapacity >::front ( ) const
inline
168  { assert(!empty()); return get_next(get_root())->value; }
bool empty() const
Definition: fixed_list.hpp:257

◆ front() [2/2]

template<typename T , size_t TCapacity>
T& std::fixed_list< T, TCapacity >::front ( )
inline
170  { assert(!empty()); return get_next(get_root())->value; }
bool empty() const
Definition: fixed_list.hpp:257

◆ insert()

template<typename T , size_t TCapacity>
iterator std::fixed_list< T, TCapacity >::insert ( iterator  pos,
const T &  value 
)
inline
209  {
210  assert(m_free_index_top > 0);
211  const int index = m_free_indices[m_free_index_top--];
212  node* new_node = construct_node(value, index);
213  link_before(new_node, pos.node());
214  ++m_num_nodes;
215  return iterator(new_node, this);
216  }
node_iterator< node *, T *, T & > iterator
Definition: fixed_list.hpp:129

◆ operator=()

template<typename T , size_t TCapacity>
fixed_list& std::fixed_list< T, TCapacity >::operator= ( const fixed_list< T, TCapacity > &  rhs)
inline
152  {
153  if (this != &rhs) {
154  copy(rhs, int_to_type<has_trivial_copy<T>::value>());
155  }
156  return *this;
157  }

◆ pop_back()

template<typename T , size_t TCapacity>
void std::fixed_list< T, TCapacity >::pop_back ( )
inline
200  {
201  assert(!empty());
202  node* back_node = get_prev(get_root());
203  m_free_indices[++m_free_index_top] = back_node->index;
204  unlink(back_node);
205  destruct_node(back_node);
206  --m_num_nodes;
207  }
bool empty() const
Definition: fixed_list.hpp:257

◆ pop_front()

template<typename T , size_t TCapacity>
void std::fixed_list< T, TCapacity >::pop_front ( )
inline
184  {
185  assert(!empty());
186  node* front_node = get_next(get_root());
187  m_free_indices[++m_free_index_top] = front_node->index;
188  unlink(front_node);
189  destruct_node(front_node);
190  --m_num_nodes;
191  }
bool empty() const
Definition: fixed_list.hpp:257

◆ push_back()

template<typename T , size_t TCapacity>
void std::fixed_list< T, TCapacity >::push_back ( const T &  value)
inline
192  {
193  assert(m_free_index_top > 0); // 0 is root
194  const int index = m_free_indices[m_free_index_top--];
195  node* new_node = construct_node(value, index);
196  ++m_num_nodes;
197  assert(m_num_nodes <= TCapacity + 1);
198  link_before(new_node, get_root());
199  }

◆ push_front()

template<typename T , size_t TCapacity>
void std::fixed_list< T, TCapacity >::push_front ( const T &  value)
inline
176  {
177  assert(m_free_index_top > 0); // 0 is root
178  const int index = m_free_indices[m_free_index_top--];
179  node* new_node = construct_node(value, index);
180  ++m_num_nodes;
181  assert(m_num_nodes <= TCapacity);
182  link_before(new_node, get_next(get_root()));
183  }

◆ size()

template<typename T , size_t TCapacity>
size_type std::fixed_list< T, TCapacity >::size ( ) const
inline
260  { return m_num_nodes; }

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