42#ifndef CCC_SINGLY_LINKED_LIST_H
43#define CCC_SINGLY_LINKED_LIST_H
49#include "private/private_singly_linked_list.h"
90#define CCC_singly_linked_list_initialize(struct_name, type_intruder_field, \
91 compare, allocate, context_data) \
92 CCC_private_singly_linked_list_initialize( \
93 struct_name, type_intruder_field, compare, allocate, context_data)
121#define CCC_singly_linked_list_with_allocator( \
122 struct_name, type_intruder_field, compare, allocate) \
123 CCC_private_singly_linked_list_with_allocator( \
124 struct_name, type_intruder_field, compare, allocate)
153#define CCC_singly_linked_list_with_context_allocator( \
154 struct_name, type_intruder_field, compare, allocate, context) \
155 CCC_private_singly_linked_list_with_context_allocator( \
156 struct_name, type_intruder_field, compare, allocate, context)
172#define CCC_singly_linked_list_from(type_intruder_field, compare, allocate, \
173 destroy, context_data, \
174 compound_literal_array...) \
175 CCC_private_singly_linked_list_from(type_intruder_field, compare, \
176 allocate, destroy, context_data, \
177 compound_literal_array)
209#define CCC_singly_linked_list_emplace_front(list_pointer, \
210 type_compound_literal...) \
211 CCC_private_singly_linked_list_emplace_front(list_pointer, \
212 type_compound_literal)
462#ifdef SINGLY_LINKED_LIST_USING_NAMESPACE_CCC
465# define singly_linked_list_initialize(arguments...) \
466 CCC_singly_linked_list_initialize(arguments)
467# define singly_linked_list_from(arguments...) \
468 CCC_singly_linked_list_from(arguments)
469# define singly_linked_list_with_allocator(arguments...) \
470 CCC_singly_linked_list_with_allocator(arguments)
471# define singly_linked_list_with_context_allocator(arguments...) \
472 CCC_singly_linked_list_with_context_allocator(arguments)
473# define singly_linked_list_emplace_front(arguments...) \
474 CCC_singly_linked_list_emplace_front(arguments)
475# define singly_linked_list_push_front(arguments...) \
476 CCC_singly_linked_list_push_front(arguments)
477# define singly_linked_list_front(arguments...) \
478 CCC_singly_linked_list_front(arguments)
479# define singly_linked_list_pop_front(arguments...) \
480 CCC_singly_linked_list_pop_front(arguments)
481# define singly_linked_list_splice(arguments...) \
482 CCC_singly_linked_list_splice(arguments)
483# define singly_linked_list_splice_range(arguments...) \
484 CCC_singly_linked_list_splice_range(arguments)
485# define singly_linked_list_extract(arguments...) \
486 CCC_singly_linked_list_extract(arguments)
487# define singly_linked_list_extract_range(arguments...) \
488 CCC_singly_linked_list_extract_range(arguments)
489# define singly_linked_list_erase(arguments...) \
490 CCC_singly_linked_list_erase(arguments)
491# define singly_linked_list_erase_range(arguments...) \
492 CCC_singly_linked_list_erase_range(arguments)
493# define singly_linked_list_sort(arguments...) \
494 CCC_singly_linked_list_sort(arguments)
495# define singly_linked_list_insert_sorted(arguments...) \
496 CCC_singly_linked_list_insert_sorted(arguments)
497# define singly_linked_list_is_sorted(arguments...) \
498 CCC_singly_linked_list_is_sorted(arguments)
499# define singly_linked_list_begin(arguments...) \
500 CCC_singly_linked_list_begin(arguments)
501# define singly_linked_list_node_begin(arguments...) \
502 CCC_singly_linked_list_node_begin(arguments)
503# define singly_linked_list_node_before_begin(arguments...) \
504 CCC_singly_linked_list_node_before_begin(arguments)
505# define singly_linked_list_end(arguments...) \
506 CCC_singly_linked_list_end(arguments)
507# define singly_linked_list_next(arguments...) \
508 CCC_singly_linked_list_next(arguments)
509# define singly_linked_list_count(arguments...) \
510 CCC_singly_linked_list_count(arguments)
511# define singly_linked_list_is_empty(arguments...) \
512 CCC_singly_linked_list_is_empty(arguments)
513# define singly_linked_list_validate(arguments...) \
514 CCC_singly_linked_list_validate(arguments)
515# define singly_linked_list_clear(arguments...) \
516 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).
CCC_Result CCC_singly_linked_list_clear(CCC_Singly_linked_list *list, CCC_Type_destructor *destroy)
Clears the list freeing memory if needed. O(N).
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).
void * CCC_singly_linked_list_erase(CCC_Singly_linked_list *list, CCC_Singly_linked_list_node *type_intruder)
Erases type_intruder from the list returning the following element. O(N).
CCC_Result CCC_singly_linked_list_sort(CCC_Singly_linked_list *list)
Sorts the singly linked list in non-decreasing order as defined by the provided comparison function....
CCC_Count CCC_singly_linked_list_count(CCC_Singly_linked_list const *list)
Return the count of nodes in the list. O(1).
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_push_front(CCC_Singly_linked_list *list, CCC_Singly_linked_list_node *type_intruder)
Push the type wrapping type_intruder to the front of the list. O(1).
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_Tribool CCC_singly_linked_list_is_sorted(CCC_Singly_linked_list const *list)
Returns true if the list is sorted in non-decreasing order according to the user provided comparison ...
CCC_Result CCC_singly_linked_list_pop_front(CCC_Singly_linked_list *list)
Pop the front element from the list. O(1).
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)
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).
void * CCC_singly_linked_list_insert_sorted(CCC_Singly_linked_list *list, CCC_Singly_linked_list_node *type_intruder)
Inserts e in sorted position according to the non-decreasing order of the list determined by the user...
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).
CCC_Tribool CCC_singly_linked_list_validate(CCC_Singly_linked_list const *list)
Returns true if the invariants of the list hold.
A type for returning an unsigned integer from a container for counting. Intended to count sizes,...
Definition: types.h:202
Definition: private_singly_linked_list.h:33
Definition: private_singly_linked_list.h:66
The C Container Collection Fundamental Types.
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:133
void CCC_Type_destructor(CCC_Type_context)
A callback function for destroying an element in the container.
Definition: types.h:376
CCC_Result
A result of actions on containers.
Definition: types.h:148