#include <clst.h>
Definition at line 67 of file clst.h.
◆ CLIST()
◆ ~CLIST()
◆ add_sorted()
bool CLIST::add_sorted |
( |
int |
comparatorconst void *, const void *, |
|
|
bool |
unique, |
|
|
void * |
new_data |
|
) |
| |
Definition at line 163 of file clst.cpp.
172 if (last ==
nullptr || comparator(&last->data, &new_data) < 0) {
174 new_element->data = new_data;
175 if (last ==
nullptr) {
176 new_element->next = new_element;
178 new_element->next = last->next;
179 last->next = new_element;
183 }
else if (!unique || last->data != new_data) {
186 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
187 void* data = it.data();
188 if (data == new_data && unique)
190 if (comparator(&data, &new_data) > 0)
193 if (it.cycled_list())
194 it.add_to_end(new_data);
◆ assign_to_sublist()
Definition at line 92 of file clst.cpp.
99 constexpr
ERRCODE LIST_NOT_EMPTY(
100 "Destination list must be empty before extracting a sublist");
◆ empty()
bool CLIST::empty |
( |
| ) |
const |
|
inline |
◆ internal_deep_clear()
void CLIST::internal_deep_clear |
( |
void(*)(void *) |
zapper | ) |
|
◆ length()
int32_t CLIST::length |
( |
| ) |
const |
◆ set_subtract()
void CLIST::set_subtract |
( |
int |
comparatorconst void *, const void *, |
|
|
bool |
unique, |
|
|
CLIST * |
minuend, |
|
|
CLIST * |
subtrahend |
|
) |
| |
Definition at line 201 of file clst.cpp.
215 for (m_it.mark_cycle_pt(); !m_it.cycled_list(); m_it.forward()) {
216 void* minu = m_it.data();
217 void* subtra =
nullptr;
219 subtra = s_it.data();
220 while (!s_it.at_last() &&
221 comparator(&subtra, &minu) < 0) {
223 subtra = s_it.data();
◆ shallow_clear()
void CLIST::shallow_clear |
( |
| ) |
|
◆ shallow_copy()
void CLIST::shallow_copy |
( |
CLIST * |
from_list | ) |
|
|
inline |
Definition at line 103 of file clst.h.
105 last = from_list->last;
◆ singleton()
bool CLIST::singleton |
( |
| ) |
const |
|
inline |
Definition at line 99 of file clst.h.
100 return last !=
nullptr ? (last == last->next) :
false;
◆ sort()
void CLIST::sort |
( |
int |
comparator const void *, const void * | ) |
|
Definition at line 124 of file clst.cpp.
141 base = static_cast<void **>(malloc (
count *
sizeof (
void *)));
145 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
146 *current = it.extract ();
151 qsort(base,
count,
sizeof(*base), comparator);
◆ CLIST_ITERATOR
The documentation for this class was generated from the following files: