45#ifndef CCC_SINGLY_LINKED_LIST_H
46#define CCC_SINGLY_LINKED_LIST_H
52#include "private/private_singly_linked_list.h"
88#define CCC_singly_linked_list_default(type_name, type_intruder_field) \
89 CCC_private_singly_linked_list_for(type_name, type_intruder_field)
98#define CCC_singly_linked_list_for(type_name, type_intruder_field) \
99 CCC_private_singly_linked_list_for(type_name, type_intruder_field)
113#define CCC_singly_linked_list_from( \
114 type_intruder_field, allocator, destructor, compound_literal_array... \
116 CCC_private_singly_linked_list_from( \
117 type_intruder_field, allocator, destructor, compound_literal_array \
156#define CCC_singly_linked_list_emplace_front( \
157 list_pointer, allocator_pointer, type_compound_literal... \
159 CCC_private_singly_linked_list_emplace_front( \
160 list_pointer, allocator_pointer, type_compound_literal \
442#ifdef SINGLY_LINKED_LIST_USING_NAMESPACE_CCC
446# define singly_linked_list_default(arguments...) \
447 CCC_singly_linked_list_default(arguments)
448# define singly_linked_list_for(arguments...) \
449 CCC_singly_linked_list_for(arguments)
450# define singly_linked_list_from(arguments...) \
451 CCC_singly_linked_list_from(arguments)
452# define singly_linked_list_emplace_front(arguments...) \
453 CCC_singly_linked_list_emplace_front(arguments)
454# define singly_linked_list_push_front(arguments...) \
455 CCC_singly_linked_list_push_front(arguments)
456# define singly_linked_list_front(arguments...) \
457 CCC_singly_linked_list_front(arguments)
458# define singly_linked_list_pop_front(arguments...) \
459 CCC_singly_linked_list_pop_front(arguments)
460# define singly_linked_list_splice(arguments...) \
461 CCC_singly_linked_list_splice(arguments)
462# define singly_linked_list_splice_range(arguments...) \
463 CCC_singly_linked_list_splice_range(arguments)
464# define singly_linked_list_extract(arguments...) \
465 CCC_singly_linked_list_extract(arguments)
466# define singly_linked_list_extract_range(arguments...) \
467 CCC_singly_linked_list_extract_range(arguments)
468# define singly_linked_list_erase(arguments...) \
469 CCC_singly_linked_list_erase(arguments)
470# define singly_linked_list_erase_range(arguments...) \
471 CCC_singly_linked_list_erase_range(arguments)
472# define singly_linked_list_sort(arguments...) \
473 CCC_singly_linked_list_sort(arguments)
474# define singly_linked_list_insert_sorted(arguments...) \
475 CCC_singly_linked_list_insert_sorted(arguments)
476# define singly_linked_list_is_sorted(arguments...) \
477 CCC_singly_linked_list_is_sorted(arguments)
478# define singly_linked_list_begin(arguments...) \
479 CCC_singly_linked_list_begin(arguments)
480# define singly_linked_list_node_begin(arguments...) \
481 CCC_singly_linked_list_node_begin(arguments)
482# define singly_linked_list_node_before_begin(arguments...) \
483 CCC_singly_linked_list_node_before_begin(arguments)
484# define singly_linked_list_end(arguments...) \
485 CCC_singly_linked_list_end(arguments)
486# define singly_linked_list_next(arguments...) \
487 CCC_singly_linked_list_next(arguments)
488# define singly_linked_list_count(arguments...) \
489 CCC_singly_linked_list_count(arguments)
490# define singly_linked_list_is_empty(arguments...) \
491 CCC_singly_linked_list_is_empty(arguments)
492# define singly_linked_list_validate(arguments...) \
493 CCC_singly_linked_list_validate(arguments)
494# define singly_linked_list_clear(arguments...) \
495 CCC_singly_linked_list_clear(arguments)
void * CCC_singly_linked_list_next(CCC_Singly_linked_list const *list, CCC_Singly_linked_list_node const *type_intruder)
Return the user type following type_intruder in the list. O(1).
void * CCC_singly_linked_list_extract(CCC_Singly_linked_list *list, CCC_Singly_linked_list_node *type_intruder)
Extracts an element from the list without freeing it. O(N).
void * CCC_singly_linked_list_push_front(CCC_Singly_linked_list *list, CCC_Singly_linked_list_node *type_intruder, CCC_Allocator const *allocator)
Push the type wrapping type_intruder to the front of the list. O(1).
CCC_Tribool CCC_singly_linked_list_is_empty(CCC_Singly_linked_list const *list)
Return true if the list is empty. O(1).
void * CCC_singly_linked_list_begin(CCC_Singly_linked_list const *list)
Return the user type at the front of the list. O(1).
CCC_Count CCC_singly_linked_list_count(CCC_Singly_linked_list const *list)
Return the count of nodes in the list. O(N).
void * CCC_singly_linked_list_extract_range(CCC_Singly_linked_list *list, CCC_Singly_linked_list_node *type_intruder_begin, CCC_Singly_linked_list_node *type_intruder_end)
Extracts a range of elements from the list without freeing them. O(N).
void * CCC_singly_linked_list_front(CCC_Singly_linked_list const *list)
Return a pointer to the element at the front of the list. O(1).
void * CCC_singly_linked_list_insert_sorted(CCC_Singly_linked_list *singly_linked_list, CCC_Singly_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...
CCC_Singly_linked_list_node * CCC_singly_linked_list_node_before_begin(CCC_Singly_linked_list const *list)
Return the list node type before the starting node. O(1).
CCC_Result CCC_singly_linked_list_splice_range(CCC_Singly_linked_list *position_list, CCC_Singly_linked_list_node *type_intruder_position, CCC_Singly_linked_list *to_cut_list, CCC_Singly_linked_list_node *type_intruder_to_cut_begin, CCC_Singly_linked_list_node *type_intruder_to_cut_exclusive_end)
Inserts the [begin, end) of spliced elements after the provided position. O(N).
CCC_Result CCC_singly_linked_list_pop_front(CCC_Singly_linked_list *list, CCC_Allocator const *allocator)
Pop the front element from the list. O(1).
CCC_Result CCC_singly_linked_list_clear(CCC_Singly_linked_list *list, CCC_Destructor const *destructor, CCC_Allocator const *allocator)
Clears the list freeing memory if needed. O(N).
void * CCC_singly_linked_list_erase_range(CCC_Singly_linked_list *list, CCC_Singly_linked_list_node *type_intruder_begin, CCC_Singly_linked_list_node *type_intruder_end, CCC_Allocator const *allocator)
Erases a range from the list returning the element after end. O(N).
void * CCC_singly_linked_list_end(CCC_Singly_linked_list const *list)
Return the sentinel at the end of the list. Do not access sentinel. O(1).
CCC_Result CCC_singly_linked_list_splice(CCC_Singly_linked_list *position_list, CCC_Singly_linked_list_node *type_intruder_position, CCC_Singly_linked_list *splice_list, CCC_Singly_linked_list_node *type_intruder_splice)
Inserts splice element after the provided position. O(N).
CCC_Singly_linked_list_node * CCC_singly_linked_list_node_begin(CCC_Singly_linked_list const *list)
Return the list node type at the front of the list. O(1).
void * CCC_singly_linked_list_erase(CCC_Singly_linked_list *list, CCC_Singly_linked_list_node *type_intruder, CCC_Allocator const *allocator)
Erases type_intruder from the list returning the following element. O(N).
CCC_Tribool CCC_singly_linked_list_is_sorted(CCC_Singly_linked_list const *singly_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 ...
CCC_Tribool CCC_singly_linked_list_validate(CCC_Singly_linked_list const *list)
Returns true if the invariants of the list hold.
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_singly_linked_list.h:31
Definition: private_singly_linked_list.h:63
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