void list_remove(t_list *alst, size_t index)
Removes the item at the specified position in the list.
void * content
The content.
void list_add_first(t_list *alst, const void *data)
Adds a copy of the specified element at the front of this list.
void list_remove_first(t_list *alst)
Removes the first item in the list.
void * list_peek_first(const t_list *alst)
Returns the first item in the list.
t_list * list_copy(const t_list *alst)
Copies an list and all it contents.
void list_merge_sort(t_list *alst)
Sorts this list in ascending order using in-place merge sort.
t_link * head
The first link.
void * list_unlink_first(t_list *alst)
Removes the first item in the list and returns it.
void * list_unlink_last(t_list *alst)
Removes the last item in the list and returns it.
void * list_peek_last(const t_list *alst)
Returns the last item in the list.
Doubly-linked list of generic items.
A full representation of a data type, used to achieve polymorphism in the implementation of data stru...
t_link * tail
The last link.
t_list * list_new(const t_type *type)
Allocates memory and initializes an empty list.
void list_remove_last(t_list *alst)
Removes the last item in the list.
void * list_unlink(t_list *alst, size_t index)
Removes the item at the specified position in the list and returns it.
size_t size
The number of items in the list.
void list_delete(t_list *alst)
Deletes the list and frees all memory taken by its contents.
const t_type * type
The type of items in this list.
struct s_link * prev
The previous link.
void * list_peek(const t_list *alst, size_t index)
Returns the item at the specified position in the list.
struct s_link * next
The next link.
void list_add_last(t_list *alst, const void *data)
Adds a copy of the specified element at the back of this list.
size_t list_size(const t_list *alst)
Returns the number of items in this list.
A link in a doubly-linked list.