44#ifndef CCC_DOUBLY_LINKED_LIST_H
45#define CCC_DOUBLY_LINKED_LIST_H
51#include "private/private_doubly_linked_list.h"
91#define CCC_doubly_linked_list_default(type_name, type_intruder_field) \
92 CCC_private_doubly_linked_list_for(type_name, type_intruder_field)
103#define CCC_doubly_linked_list_for(type_name, type_intruder_field) \
104 CCC_private_doubly_linked_list_for(type_name, type_intruder_field)
119#define CCC_doubly_linked_list_from( \
120 type_intruder_field, allocator, destructor, compound_literal_array... \
122 CCC_private_doubly_linked_list_from( \
123 type_intruder_field, allocator, destructor, compound_literal_array \
146#define CCC_doubly_linked_list_emplace_back( \
147 list_pointer, allocator_pointer, type_compound_literal... \
149 CCC_private_doubly_linked_list_emplace_back( \
150 list_pointer, allocator_pointer, type_compound_literal \
167#define CCC_doubly_linked_list_emplace_front( \
168 list_pointer, allocator_pointer, type_compound_literal... \
170 CCC_private_doubly_linked_list_emplace_front( \
171 list_pointer, allocator_pointer, type_compound_literal \
516#ifdef DOUBLY_LINKED_LIST_USING_NAMESPACE_CCC
520# define doubly_linked_list_default(arguments...) \
521 CCC_doubly_linked_list_default(arguments)
522# define doubly_linked_list_for(arguments...) \
523 CCC_doubly_linked_list_for(arguments)
524# define doubly_linked_list_from(arguments...) \
525 CCC_doubly_linked_list_from(arguments)
526# define doubly_linked_list_emplace_back(arguments...) \
527 CCC_doubly_linked_list_emplace_back(arguments)
528# define doubly_linked_list_emplace_front(arguments...) \
529 CCC_doubly_linked_list_emplace_front(arguments)
530# define doubly_linked_list_push_front(arguments...) \
531 CCC_doubly_linked_list_push_front(arguments)
532# define doubly_linked_list_push_back(arguments...) \
533 CCC_doubly_linked_list_push_back(arguments)
534# define doubly_linked_list_front(arguments...) \
535 CCC_doubly_linked_list_front(arguments)
536# define doubly_linked_list_back(arguments...) \
537 CCC_doubly_linked_list_back(arguments)
538# define doubly_linked_list_pop_front(arguments...) \
539 CCC_doubly_linked_list_pop_front(arguments)
540# define doubly_linked_list_pop_back(arguments...) \
541 CCC_doubly_linked_list_pop_back(arguments)
542# define doubly_linked_list_extract(arguments...) \
543 CCC_doubly_linked_list_extract(arguments)
544# define doubly_linked_list_extract_range(arguments...) \
545 CCC_doubly_linked_list_extract_range(arguments)
546# define doubly_linked_list_erase(arguments...) \
547 CCC_doubly_linked_list_erase(arguments)
548# define doubly_linked_list_erase_range(arguments...) \
549 CCC_doubly_linked_list_erase_range(arguments)
550# define doubly_linked_list_splice(arguments...) \
551 CCC_doubly_linked_list_splice(arguments)
552# define doubly_linked_list_splice_range(arguments...) \
553 CCC_doubly_linked_list_splice_range(arguments)
554# define doubly_linked_list_sort(arguments...) \
555 CCC_doubly_linked_list_sort(arguments)
556# define doubly_linked_list_insert_sorted(arguments...) \
557 CCC_doubly_linked_list_insert_sorted(arguments)
558# define doubly_linked_list_is_sorted(arguments...) \
559 CCC_doubly_linked_list_is_sorted(arguments)
560# define doubly_linked_list_begin(arguments...) \
561 CCC_doubly_linked_list_begin(arguments)
562# define doubly_linked_list_next(arguments...) \
563 CCC_doubly_linked_list_next(arguments)
564# define doubly_linked_list_reverse_begin(arguments...) \
565 CCC_doubly_linked_list_reverse_begin(arguments)
566# define doubly_linked_list_reverse_next(arguments...) \
567 CCC_doubly_linked_list_reverse_next(arguments)
568# define doubly_linked_list_end(arguments...) \
569 CCC_doubly_linked_list_end(arguments)
570# define doubly_linked_list_reverse_end(arguments...) \
571 CCC_doubly_linked_list_reverse_end(arguments)
572# define doubly_linked_list_node_begin(arguments...) \
573 CCC_doubly_linked_list_node_begin(arguments)
574# define doubly_linked_list_count(arguments...) \
575 CCC_doubly_linked_list_count(arguments)
576# define doubly_linked_list_is_empty(arguments...) \
577 CCC_doubly_linked_list_is_empty(arguments)
578# define doubly_linked_list_clear(arguments...) \
579 CCC_doubly_linked_list_clear(arguments)
580# define doubly_linked_list_validate(arguments...) \
581 CCC_doubly_linked_list_validate(arguments)
CCC_Result CCC_doubly_linked_list_pop_back(CCC_Doubly_linked_list *list, CCC_Allocator const *allocator)
Pop the user type at the back of the list. O(1).
void * CCC_doubly_linked_list_next(CCC_Doubly_linked_list const *list, CCC_Doubly_linked_list_node const *type_intruder)
Return the user type following the element known to be in the list. O(1).
void * CCC_doubly_linked_list_insert_sorted(CCC_Doubly_linked_list *doubly_linked_list, CCC_Doubly_linked_list_node *type_intruder, CCC_Order order, CCC_Comparator const *comparator, CCC_Allocator const *allocator)
Inserts type_intruder in sorted position according to the non-decreasing order of the list determined...
void * CCC_doubly_linked_list_push_front(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder, CCC_Allocator const *allocator)
Push user type wrapping type_intruder to the front of the list. O(1).
void * CCC_doubly_linked_list_erase(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder, CCC_Allocator const *allocator)
Returns the element following an erased element from the list. O(1).
CCC_Result CCC_doubly_linked_list_splice(CCC_Doubly_linked_list *position_doubly_linked_list, CCC_Doubly_linked_list_node *type_intruder_position, CCC_Doubly_linked_list *to_cut_doubly_linked_list, CCC_Doubly_linked_list_node *type_intruder_to_cut)
Repositions to_cut before pos. Only list pointers are modified. O(1).
CCC_Count CCC_doubly_linked_list_count(CCC_Doubly_linked_list const *list)
Return the count of elements in the list. O(N).
void * CCC_doubly_linked_list_extract(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder)
Returns the element following an extracted element from the list without deallocating regardless of a...
void * CCC_doubly_linked_list_insert(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *position_node, CCC_Doubly_linked_list_node *type_intruder, CCC_Allocator const *allocator)
Insert user type wrapping type_intruder before position_node. O(1).
CCC_Tribool CCC_doubly_linked_list_validate(CCC_Doubly_linked_list const *list)
Validates internal state of the list.
void * CCC_doubly_linked_list_push_back(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder, CCC_Allocator const *allocator)
Push user type wrapping type_intruder to the back of the list. O(1).
CCC_Result CCC_doubly_linked_list_splice_range(CCC_Doubly_linked_list *position_doubly_linked_list, CCC_Doubly_linked_list_node *type_intruder_position, CCC_Doubly_linked_list *to_cut_doubly_linked_list, CCC_Doubly_linked_list_node *type_intruder_to_cut_begin, CCC_Doubly_linked_list_node *type_intruder_to_cut_exclusive_end)
Splices the list to cut before the specified position. The range being cut is exclusive from [start,...
CCC_Doubly_linked_list_node * CCC_doubly_linked_list_node_begin(CCC_Doubly_linked_list const *list)
Return a handle to the list element at the front of the list which may be the sentinel....
void * CCC_doubly_linked_list_end(CCC_Doubly_linked_list const *list)
Return the end sentinel with no accessible fields. O(1).
void * CCC_doubly_linked_list_reverse_end(CCC_Doubly_linked_list const *list)
Return the start sentinel with no accessible fields. O(1).
void * CCC_doubly_linked_list_begin(CCC_Doubly_linked_list const *list)
Return the user type at the start of the list or NULL if empty. O(1).
void * CCC_doubly_linked_list_reverse_next(CCC_Doubly_linked_list const *list, CCC_Doubly_linked_list_node const *type_intruder)
Return the user type following the element known to be in the list moving from back to front....
CCC_Tribool CCC_doubly_linked_list_is_empty(CCC_Doubly_linked_list const *list)
Return if the size of the list is equal to 0. O(1).
CCC_Result CCC_doubly_linked_list_pop_front(CCC_Doubly_linked_list *list, CCC_Allocator const *allocator)
Pop the user type at the front of the list. O(1).
void * CCC_doubly_linked_list_extract_range(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder_begin, CCC_Doubly_linked_list_node *type_intruder_end)
Returns the element following an extracted range of elements from the list without deallocating regar...
void * CCC_doubly_linked_list_erase_range(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder_begin, CCC_Doubly_linked_list_node *type_intruder_end, CCC_Allocator const *allocator)
Returns the element following an extracted range of elements from the list. O(N).
void * CCC_doubly_linked_list_front(CCC_Doubly_linked_list const *list)
Returns the user type at the front of the list. O(1).
void * CCC_doubly_linked_list_back(CCC_Doubly_linked_list const *list)
Returns the user type at the back of the list. O(1).
void * CCC_doubly_linked_list_reverse_begin(CCC_Doubly_linked_list const *list)
Return the user type at the end of the list or NULL if empty. O(1).
CCC_Result CCC_doubly_linked_list_clear(CCC_Doubly_linked_list *list, CCC_Destructor const *destructor, CCC_Allocator const *allocator)
Clear the contents of the list freeing elements, if given allocation permission. O(N).
CCC_Tribool CCC_doubly_linked_list_is_sorted(CCC_Doubly_linked_list const *doubly_linked_list, CCC_Order order, CCC_Comparator const *comparator)
Returns true if the list is sorted in non-decreasing order according to the user provided comparison ...
The type passed by reference to any container function that may need to allocate memory....
Definition: types.h:376
The type passed by reference to any container function that may need to compare elements....
Definition: types.h:416
A type for returning an unsigned integer from a container for counting. Intended to count sizes,...
Definition: types.h:244
The type passed by reference to any container function that may need to destroy elements....
Definition: types.h:464
Definition: private_doubly_linked_list.h:32
Definition: private_doubly_linked_list.h:66
The C Container Collection Fundamental Types.
CCC_Order
A three-way comparison for comparison functions.
Definition: types.h:214
CCC_Tribool
A three state boolean to allow for an error state. Error is -1, False is 0, and True is 1.
Definition: types.h:178
CCC_Result
A result of actions on containers.
Definition: types.h:192