11#include "bits/list_basics.h"
21template<
typename ELEM_TYPE>
42 template<
typename T,
typename P>
friend class H_list;
43 template<
typename T,
typename X>
friend struct Bits::Basic_list_policy;
45 void l_remove() noexcept
68template<
typename T,
typename POLICY = Bits::Basic_list_policy< T, H_list_item> >
72 typedef typename POLICY::Item_type Item;
75 void operator = (
H_list const &);
78 typedef typename Base::Iterator Iterator;
93 static Iterator
iter(T *c) {
return Base::__iter(c->Item::_pn); }
96 static bool in_list(T
const *e) {
return e->Item::_pn; }
102 this->
_f->_pn = &e->Item::_n;
103 e->Item::_n = this->
_f;
104 e->Item::_pn = &this->
_f;
105 this->
_f =
static_cast<Item*
>(e);
118 T *r = this->
front();
133 Iterator
insert(T *e, Iterator
const &pred)
135 Item **x = &this->
_f;
142 (*x)->_pn = &(e->Item::_n);
145 *x =
static_cast<Item*
>(e);
133 Iterator
insert(T *e, Iterator
const &pred) {
…}
162 Item **x = &(*pred)->_n;
166 (*x)->_pn = &(e->Item::_n);
169 *x =
static_cast<Item*
>(e);
182 Item **x = Base::__get_internal(succ);
188 (*x)->_pn = &e->Item::_n;
190 *x =
static_cast<Item*
>(e);
206 e->Item::_n = p->Item::_n;
207 e->Item::_pn = p->Item::_pn;
208 *(p->Item::_pn) =
static_cast<Item*
>(e);
210 e->Item::_n->_pn = &(e->Item::_n);
221 { e->Item::l_remove(); }
236 static Iterator
erase(Iterator
const &e)
237 { e->Item::l_remove();
return e; }
236 static Iterator
erase(Iterator
const &e) {
…}
247template<
typename T >
256template<
typename T >
257class H_list_bss :
public H_list<T>
260 H_list_bss() :
H_list<T>(true) {}
263template<
typename T >
264class H_list_t_bss :
public H_list_t<T>
267 H_list_t_bss() : H_list_t<T>(true) {}
Internal: Common functions for all head-based list implementations.
Const_iterator end() const
Return a const iterator to the end of the list.
POLICY::Head_type _f
Pointer to front of the list.
Value_type front() const
Return the first element in the list.
Basic element type for a double-linked H_list.
H_list_item_t()
Constructor.
~H_list_item_t() noexcept
Destructor.
General double-linked list of unspecified cxx::H_list_item elements.
static Iterator insert_after(T *e, Iterator const &pred)
Insert an element after the iterator position.
T * pop_front()
Remove and return the head element of the list.
static void replace(T *p, T *e)
Replace an element in a list with a new element.
static Iterator erase(Iterator const &e)
Remove the element at the given iterator position.
static void insert_before(T *e, Iterator const &succ)
Insert an element before the iterator position.
void add(T *e)
Add element to the front of the list.
Iterator insert(T *e, Iterator const &pred)
Insert an element at the iterator position.
static void remove(T *e)
Remove the given element from its list.
static Iterator iter(T *c)
Return an iterator for an arbitrary list element.
static bool in_list(T const *e)
Check if the given element is currently part of a list.
void push_front(T *e)
Add element to the front of the list.
H_list_item_t< void > H_list_item
Untyped list item.
Double-linked list of typed H_list_item_t elements.