Utilities#
Retrieve Length#
Retrieve Length (with threshold)#
Callback function for each element#
Append Element#
-
void ntl_append2(ntl_t *p, size_t elem_size, void *added_elem)#
Append a element to the null-terminated list.
Append a element to the NTL, this is not efficient for many appends.
Note
Its the caller’s responsibility to make sure
added_elem
has the same type and size as the NTL.- Parameters:
p – the NTL pointer
elem_size – the size of each NTL element
added_elem – the element to be appended
Map Elements#
-
typedef void (*ntl_elem_map)(void *cxt, void *from_elem, void *to_elem)#
Callback function for creating and mapping a NTL to another.
-
ntl_t ntl_fmap(void *cxt, ntl_t in_list, size_t out_elem_size, ntl_elem_map map)#
Behaves similarly to Haskell list’s fmap.
- Parameters:
cxt – an optional user-arbitrary data to be passed along the callbacks
in_list – the input NTL
out_elem_size – the size of each output element
map – the callback function to map each
in_list
element to thereturned
NTL element
- Returns:
the new NTL