Vector 0.0.2
|
Constructors/Destructors. More...
Macros | |
#define | alloc_opts(...) (alloc_opts_t){__VA_ARGS__} |
Use this macro to define allocator opts in vector_opts_t. | |
#define | vector_create(...) |
Vector constructor. | |
Functions | |
vector_t * | vector_create_ (const vector_opts_t *const opts) |
Vector contructor. | |
void | vector_destroy (vector_t *const vector) |
Deallocates vector. | |
vector_t * | vector_clone (const vector_t *const vector) |
Duplicates a vector. | |
vector_status_t | vector_resize (vector_t **const vector, const size_t capacity, const vector_status_t error) |
Performs allocation resize. | |
Constructors/Destructors.
#define alloc_opts | ( | ... | ) | (alloc_opts_t){__VA_ARGS__} |
Use this macro to define allocator opts in vector_opts_t.
#define vector_create | ( | ... | ) |
Vector constructor.
Preferable way to invoke vector constructor. Provides default values.
vector_t * vector_create_ | ( | const vector_opts_t *const | opts | ) |
Vector contructor.
Vector constructor function that initializes vector with properties packed in opts struct. Space for initial_cap elements will be reserved. In case of allocation fail null pointer will be returned via vector
argument.
[in] | opts | Options according to which vector will be created. |
NULL
if allocation failed. Definition at line 82 of file vector.c.
void vector_destroy | ( | vector_t *const | vector | ) |
vector_status_t vector_resize | ( | vector_t **const | vector, |
const size_t | capacity, | ||
const vector_status_t | error ) |
Performs allocation resize.
Resizes vector to a desired capacity, wiping out elements beyond new capacity bounds. Takes third parameter which denotes error type that will be returned if resize fails.
[in] | vector | Reference to vectors pointer. |
[in] | capacity | Desired vectors capacity. |
[in] | error | Extension feature, error status code that will be returned upon allocation failure. |
Definition at line 141 of file vector.c.