22#include "bits/list_basics.h"
32template<
typename ELEM_TYPE>
53 template<
typename T,
typename P>
friend class H_list;
54 template<
typename T,
typename X>
friend struct Bits::Basic_list_policy;
56 void l_remove() noexcept
79template<
typename T,
typename POLICY = Bits::Basic_list_policy< T, H_list_item> >
83 typedef typename POLICY::Item_type Item;
86 void operator = (
H_list const &);
89 typedef typename Base::Iterator Iterator;
104 static Iterator
iter(T *c) {
return Base::__iter(c->Item::_pn); }
107 static bool in_list(T
const *e) {
return e->Item::_pn; }
113 this->
_f->_pn = &e->Item::_n;
114 e->Item::_n = this->
_f;
115 e->Item::_pn = &this->
_f;
116 this->
_f =
static_cast<Item*
>(e);
129 T *r = this->
front();
144 Iterator
insert(T *e, Iterator
const &pred)
146 Item **x = &this->
_f;
153 (*x)->_pn = &(e->Item::_n);
156 *x =
static_cast<Item*
>(e);
173 Item **x = &(*pred)->_n;
177 (*x)->_pn = &(e->Item::_n);
180 *x =
static_cast<Item*
>(e);
193 Item **x = Base::__get_internal(succ);
199 (*x)->_pn = &e->Item::_n;
201 *x =
static_cast<Item*
>(e);
217 e->Item::_n = p->Item::_n;
218 e->Item::_pn = p->Item::_pn;
219 *(p->Item::_pn) =
static_cast<Item*
>(e);
221 e->Item::_n->_pn = &(e->Item::_n);
232 { e->Item::l_remove(); }
247 static Iterator
erase(Iterator
const &e)
248 { e->Item::l_remove();
return e; }
258template<
typename T >
267template<
typename T >
268class H_list_bss :
public H_list<T>
271 H_list_bss() :
H_list<T>(true) {}
274template<
typename T >
275class H_list_t_bss :
public H_list_t<T>
278 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.