cdcontainers  0.1.1
Library of data containers and collections for C programming language.
Functions
Operations

Functions

void cdc_list_splice (struct cdc_list_iter *position, struct cdc_list_iter *first, struct cdc_list_iter *last)
 Transfers elements from one container, iterators (first, last] to another container at position before iterator position. More...
 
void cdc_list_ssplice (struct cdc_list_iter *position, struct cdc_list_iter *first)
 Transfers elements from one container, iterators (first, end] to another container at position before iterator position. More...
 
void cdc_list_lsplice (struct cdc_list_iter *position, struct cdc_list *other)
 Transfers all elements from container other to another container at position before iterator position. More...
 
void cdc_list_merge (struct cdc_list *l, struct cdc_list *other)
 Merges two sorted lists into one. The lists should be sorted into ascending order. More...
 
void cdc_list_cmerge (struct cdc_list *l, struct cdc_list *other, cdc_binary_pred_fn_t compare)
 Merges two sorted lists into one. The lists should be sorted. More...
 
void cdc_list_erase_if (struct cdc_list *l, cdc_unary_pred_fn_t pred)
 Removes from the container all elements for which predicate pred returns true. More...
 
void cdc_list_reverse (struct cdc_list *l)
 Reverses the order of elements in the container. More...
 
void cdc_list_unique (struct cdc_list *l)
 Removes all consecutive duplicate elements from the container. Only the first element in each group of equal elements is left. More...
 
void cdc_list_punique (struct cdc_list *l, cdc_binary_pred_fn_t pred)
 Removes all consecutive duplicate elements from the container. Only the first element in each group of equal elements is left. More...
 
void cdc_list_sort (struct cdc_list *l)
 Sorts elements in ascending order. More...
 
void cdc_list_csort (struct cdc_list *l, cdc_binary_pred_fn_t compare)
 Sorts elements in ascending order. More...
 
void cdc_list_foreach (struct cdc_list *l, void(*cb)(void *))
 A function |cb| is applied to each item of the list. More...
 

Detailed Description

Function Documentation

◆ cdc_list_splice()

void cdc_list_splice ( struct cdc_list_iter position,
struct cdc_list_iter first,
struct cdc_list_iter last 
)

Transfers elements from one container, iterators (first, last] to another container at position before iterator position.

Parameters
[in]position- iterator before which the content will be inserted
[in]first,last- range of elements to transfer from other

◆ cdc_list_ssplice()

void cdc_list_ssplice ( struct cdc_list_iter position,
struct cdc_list_iter first 
)

Transfers elements from one container, iterators (first, end] to another container at position before iterator position.

Parameters
[in]position- iterator before which the content will be inserted
[in]first- beginning of the range from which elements will be transferred

◆ cdc_list_lsplice()

void cdc_list_lsplice ( struct cdc_list_iter position,
struct cdc_list other 
)

Transfers all elements from container other to another container at position before iterator position.

Parameters
[in]position- iterator before which the content will be inserted

◆ cdc_list_merge()

void cdc_list_merge ( struct cdc_list l,
struct cdc_list other 
)

Merges two sorted lists into one. The lists should be sorted into ascending order.

Parameters
[in]l- cdc_list
[in]other- another cdc_list to merge

◆ cdc_list_cmerge()

void cdc_list_cmerge ( struct cdc_list l,
struct cdc_list other,
cdc_binary_pred_fn_t  compare 
)

Merges two sorted lists into one. The lists should be sorted.

Parameters
[in]l- cdc_list
[in]other- another cdc_list to merge
[in]compare- comparison function

◆ cdc_list_erase_if()

void cdc_list_erase_if ( struct cdc_list l,
cdc_unary_pred_fn_t  pred 
)

Removes from the container all elements for which predicate pred returns true.

Parameters
[in]l- cdc_list
[in]pred- unary predicate which returns ​true if the element should be removed

◆ cdc_list_reverse()

void cdc_list_reverse ( struct cdc_list l)

Reverses the order of elements in the container.

Parameters
[in]l- cdc_list

◆ cdc_list_unique()

void cdc_list_unique ( struct cdc_list l)

Removes all consecutive duplicate elements from the container. Only the first element in each group of equal elements is left.

Parameters
[in]l- cdc_list

◆ cdc_list_punique()

void cdc_list_punique ( struct cdc_list l,
cdc_binary_pred_fn_t  pred 
)

Removes all consecutive duplicate elements from the container. Only the first element in each group of equal elements is left.

Parameters
[in]l- cdc_list
[in]pred- binary predicate which returns ​true if the elements should be treated as equal.

◆ cdc_list_sort()

void cdc_list_sort ( struct cdc_list l)

Sorts elements in ascending order.

Parameters
[in]l- cdc_list

◆ cdc_list_csort()

void cdc_list_csort ( struct cdc_list l,
cdc_binary_pred_fn_t  compare 
)

Sorts elements in ascending order.

Parameters
[in]l- cdc_list
[in]compare- comparison function object which returns ​true if the first argument is less than (i.e. is ordered before) the second.

◆ cdc_list_foreach()

void cdc_list_foreach ( struct cdc_list l,
void(*)(void *)  cb 
)

A function |cb| is applied to each item of the list.