List of all members.
Public Member Functions |
bool | operator== (const base_list &rhs) const |
void | empty () |
| base_list (const base_list &tmp) |
| base_list (const base_list &rhs, MEM_ROOT *mem_root) |
| base_list (bool error) |
bool | push_back (void *info) |
bool | push_back (void *info, MEM_ROOT *mem_root) |
bool | push_front (void *info) |
void | remove (list_node **prev) |
void | concat (base_list *list) |
void * | pop (void) |
void | disjoin (base_list *list) |
void | prepand (base_list *list) |
void | sort (Node_cmp_func cmp, void *arg) |
| Sort the list.
|
void | swap (base_list &rhs) |
list_node * | last_node () |
list_node * | first_node () |
void * | head () |
void ** | head_ref () |
bool | is_empty () const |
list_node * | last_ref () |
Public Attributes |
uint | elements |
Protected Member Functions |
void | after (void *info, list_node *node) |
Protected Attributes |
list_node * | first |
list_node ** | last |
Friends |
class | base_list_iterator |
class | error_list |
class | error_list_iterator |
Constructor & Destructor Documentation
base_list::base_list |
( |
const base_list & |
tmp | ) |
[inline] |
This is a shallow copy constructor that implicitly passes the ownership from the source list to the new instance. The old instance is not updated, so both objects end up sharing the same nodes. If one of the instances then adds or removes a node, the other becomes out of sync ('last' pointer), while still operational. Some old code uses and relies on this behaviour. This logic is quite tricky: please do not use it in any new code.
base_list::base_list |
( |
const base_list & |
rhs, |
|
|
MEM_ROOT * |
mem_root |
|
) |
| |
Construct a deep copy of the argument in memory root mem_root. The elements themselves are copied by pointer. If you also need to copy elements by value, you should employ list_copy_and_replace_each_value after creating a copy.
Member Function Documentation
Sort the list.
- Parameters:
-
cmp | node comparison function |
arg | additional info to be passed to comparison function |
The function sorts list nodes by an exchange sort algorithm. The order of list nodes isn't changed, values of info fields are swapped instead. Due to this, list iterators that are initialized before sort could be safely used after sort, i.e they wouldn't cause a crash. As this isn't an effective algorithm the list to be sorted is supposed to be short.
The documentation for this class was generated from the following files: