Go to the documentation of this file.
24 # define ARRAY_INIT_CAPACITY 4
27 # include <sys/types.h>
t_queue * array_to_queue(const t_array *array)
Returns a queue that contains copies of the element in this array.
void array_insertion_sort(t_array *array)
Sorts this array using insertion sort.
void array_remove(t_array *array, size_t index)
Deletes the item at the specified index.
t_array * array_zeros(const t_type *type, size_t size)
Initializes a new array of the specified size, filled with zeros.
t_array * array_new(const t_type *type)
Initializes a new empty array.
void array_quick_sort(t_array *array)
Sorts this array using quick sort.
void array_delete(t_array *array)
Deletes this array and free all its items and the associated data.
void array_swap(t_array *array, size_t ind1, size_t ind2)
Swaps elements at the two specified positions in the array.
int array_sorted(const t_array *array)
Checks if an array is sorted in ascending order.
void array_set(t_array *array, size_t index, const void *content)
Replaces the element at the specified position in this array with a copy of the specified element.
Doubly-linked list of generic items.
ssize_t array_indexof(const t_array *array, const void *val)
Returns the index at which the specified value is found in the array, or -1 if the value isn't the ar...
A full representation of a data type, used to achieve polymorphism in the implementation of data stru...
const t_type * type
The type of items in this array.
t_array * array_copy(const t_array *array)
Copies the array and all it contents.
void array_append(t_array *array, const void *content)
Appends a copy the specified element to the end of this array.
void * array_get(const t_array *array, size_t index)
Returns the item at the specified position in this list.
size_t capacity
The capacity of this array.
size_t size
The number of items in this array.
size_t array_size(const t_array *array)
Returns the number of elements in this array.
void array_insert(t_array *array, size_t index, const void *content)
Inserts a copy of the specified item at the specified index.
void array_merge_sort(t_array *array)
Sorts this array using merge sort.
void * array_pop(t_array *array)
Removes and returns the element at the end of this array.