|
CArray v1.0.0-build
Minimal and Extensible Array Implementation for C
|
Go to the source code of this file.
Classes | |
| struct | CARR |
| Represents a pointer-based vector container. More... | |
Typedefs | |
| typedef struct CARR | CARR |
| typedef enum CARRError | CARRError |
Enumerations | |
| enum | CARRError { CARR_VEC_OK , CARR_VEC_OutOfBounds , CARR_VEC_ResizeError , CARR_VEC_OOM , CARR_VEC_NULL } |
| Error codes returned by CARR operations. More... | |
Functions | |
| CARRError | carr_deleteIndex (CARR *vec, const size_t index, const bool fall) |
| Deletes an element at a specified index. | |
| void | carr_destroy (CARR *vec) |
| Destroys a vector and releases its internal resources. | |
| CARR | carr_init (const size_t cap, const bool dynamic) |
| Initializes a new CARR vector. | |
| CARRError | carr_pushBack (CARR *vec, void *item) |
| Appends an element to the end of the vector. | |
| CARRError | carr_pushFront (CARR *vec, void *item) |
| Inserts an element at the beginning of the vector. | |
| CARRError | carr_replaceIndex (CARR *vec, void *item, const size_t idx) |
| Replaces an element at a specified index. | |
| CARRError | carr_resize (CARR *vec, const size_t newCap) |
| Changes the capacity of a vector. | |
| CARRError | carr_reverse (CARR *vec) |
| Reverses the order of elements in the vector. | |
| typedef struct CARR CARR |
| enum CARRError |
Error codes returned by CARR operations.
Definition at line 82 of file carr.h.
Deletes an element at a specified index.
Removes the element at index from the vector.
| [in,out] | vec | Pointer to the vector to modify. |
| [in] | index | Index of the element to delete. |
| [in] | fall | Controls the deletion behavior, as defined by the implementation. |
References carr_deleteIndex().
Referenced by carr_deleteIndex().
| void carr_destroy | ( | CARR * | vec | ) |
Destroys a vector and releases its internal resources.
Releases resources owned by the vector implementation and invalidates the vector's internal storage.
| [in,out] | vec | Pointer to the vector to destroy. |
References carr_destroy().
Referenced by carr_destroy().
| CARR carr_init | ( | const size_t | cap, |
| const bool | dynamic ) |
Initializes a new CARR vector.
Creates a vector with the requested initial capacity and resizing mode.
| [in] | cap | Initial capacity of the vector. |
| [in] | dynamic | Whether the vector supports dynamic resizing. |
References carr_init().
Referenced by carr_init().
Appends an element to the end of the vector.
Stores item after the current last element. Depending on the vector's configuration, the operation may require additional capacity.
| [in,out] | vec | Pointer to the vector to modify. |
| [in] | item | Pointer to the element to append. |
References carr_pushBack().
Referenced by carr_pushBack().
Inserts an element at the beginning of the vector.
Stores item at index zero and shifts existing elements as necessary.
| [in,out] | vec | Pointer to the vector to modify. |
| [in] | item | Pointer to the element to insert. |
References carr_pushFront().
Referenced by carr_pushFront().
Replaces an element at a specified index.
Assigns a new pointer to the element at idx.
| [in,out] | vec | Pointer to the vector to modify. |
| [in] | item | Pointer to the replacement element. |
| [in] | idx | Index of the element to replace. |
References carr_replaceIndex().
Referenced by carr_replaceIndex().
Changes the capacity of a vector.
Requests a new capacity for the vector's underlying pointer array.
| [in,out] | vec | Pointer to the vector to resize. |
| [in] | newCap | Desired capacity. |
References carr_resize().
Referenced by carr_resize().
Reverses the order of elements in the vector.
Reorders the stored pointers so that the first element becomes the last, the second becomes the second-to-last, and so on.
| [in,out] | vec | Pointer to the vector to reverse. |
References carr_reverse().
Referenced by carr_reverse().