mirror of
https://github.com/lifegpc/c-utils.git
synced 2026-06-06 05:08:45 +08:00
Update utils
This commit is contained in:
@@ -340,6 +340,14 @@ void linked_list_remove(struct LinkedList<T>*& node, void(*free_func)(T) = nullp
|
|||||||
free(node);
|
free(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void linked_list_remove_before(struct LinkedList<T>* node, void(*free_func)(T) = nullptr) {
|
||||||
|
if (!node) return;
|
||||||
|
while (node->prev) {
|
||||||
|
linked_list_remove(node->prev, free_func);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct LinkedList<T>* linked_list_tail(struct LinkedList<T>* list) {
|
struct LinkedList<T>* linked_list_tail(struct LinkedList<T>* list) {
|
||||||
if (!list) return nullptr;
|
if (!list) return nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user