include/Zycore/Vector.h(3)
π NAME π
include/Zycore/Vector.h β no cap, this is the header for Zycore's vector container. Everything vector-y lives here bestie π¦
β¨ SYNOPSIS β¨
Get comfy, because this header pulls in its whole little friend group first π:
#include <Zycore/Allocator.h>
#include <Zycore/Comparison.h>
#include <Zycore/Object.h>
#include <Zycore/Status.h>
#include <Zycore/Types.h>
π Classes
struct ZyanVector_
π§ Macros
#define ZYAN_VECTOR_MIN_CAPACITY 1#define ZYAN_VECTOR_DEFAULT_GROWTH_FACTOR 2#define ZYAN_VECTOR_DEFAULT_SHRINK_THRESHOLD 4#define ZYAN_VECTOR_INITIALIZER#define ZYAN_VECTOR_GET(type, vector, index)#define ZYAN_VECTOR_FOREACH(type, vector, item_name, body)#define ZYAN_VECTOR_FOREACH_MUTABLE(type, vector, item_name, body)
π Typedefs
typedef struct ZyanVector_ ZyanVector
π Functions
ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanVectorInit (ZyanVector *vector, ZyanUSize element_size, ZyanUSize capacity, ZyanMemberProcedure destructor)ZYCORE_EXPORT ZyanStatus ZyanVectorInitEx (ZyanVector *vector, ZyanUSize element_size, ZyanUSize capacity, ZyanMemberProcedure destructor, ZyanAllocator *allocator, ZyanU8 growth_factor, ZyanU8 shrink_threshold)ZYCORE_EXPORT ZyanStatus ZyanVectorInitCustomBuffer (ZyanVector *vector, ZyanUSize element_size, void *buffer, ZyanUSize capacity, ZyanMemberProcedure destructor)ZYCORE_EXPORT ZyanStatus ZyanVectorDestroy (ZyanVector *vector)ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanVectorDuplicate (ZyanVector *destination, const ZyanVector *source, ZyanUSize capacity)ZYCORE_EXPORT ZyanStatus ZyanVectorDuplicateEx (ZyanVector *destination, const ZyanVector *source, ZyanUSize capacity, ZyanAllocator *allocator, ZyanU8 growth_factor, ZyanU8 shrink_threshold)ZYCORE_EXPORT ZyanStatus ZyanVectorDuplicateCustomBuffer (ZyanVector *destination, const ZyanVector *source, void *buffer, ZyanUSize capacity)ZYCORE_EXPORT const void * ZyanVectorGet (const ZyanVector *vector, ZyanUSize index)ZYCORE_EXPORT void * ZyanVectorGetMutable (const ZyanVector *vector, ZyanUSize index)ZYCORE_EXPORT ZyanStatus ZyanVectorGetPointer (const ZyanVector *vector, ZyanUSize index, const void **value)ZYCORE_EXPORT ZyanStatus ZyanVectorGetPointerMutable (const ZyanVector *vector, ZyanUSize index, void **value)ZYCORE_EXPORT ZyanStatus ZyanVectorSet (ZyanVector *vector, ZyanUSize index, const void *value)ZYCORE_EXPORT ZyanStatus ZyanVectorPushBack (ZyanVector *vector, const void *element)ZYCORE_EXPORT ZyanStatus ZyanVectorInsert (ZyanVector *vector, ZyanUSize index, const void *element)ZYCORE_EXPORT ZyanStatus ZyanVectorInsertRange (ZyanVector *vector, ZyanUSize index, const void *elements, ZyanUSize count)ZYCORE_EXPORT ZyanStatus ZyanVectorEmplace (ZyanVector *vector, void **element, ZyanMemberFunction constructor)ZYCORE_EXPORT ZyanStatus ZyanVectorEmplaceEx (ZyanVector *vector, ZyanUSize index, void **element, ZyanMemberFunction constructor)ZYCORE_EXPORT ZyanStatus ZyanVectorSwapElements (ZyanVector *vector, ZyanUSize index_first, ZyanUSize index_second)ZYCORE_EXPORT ZyanStatus ZyanVectorDelete (ZyanVector *vector, ZyanUSize index)ZYCORE_EXPORT ZyanStatus ZyanVectorDeleteRange (ZyanVector *vector, ZyanUSize index, ZyanUSize count)ZYCORE_EXPORT ZyanStatus ZyanVectorPopBack (ZyanVector *vector)ZYCORE_EXPORT ZyanStatus ZyanVectorClear (ZyanVector *vector)ZYCORE_EXPORT ZyanStatus ZyanVectorFind (const ZyanVector *vector, const void *element, ZyanISize *found_index, ZyanEqualityComparison comparison)ZYCORE_EXPORT ZyanStatus ZyanVectorFindEx (const ZyanVector *vector, const void *element, ZyanISize *found_index, ZyanEqualityComparison comparison, ZyanUSize index, ZyanUSize count)ZYCORE_EXPORT ZyanStatus ZyanVectorBinarySearch (const ZyanVector *vector, const void *element, ZyanUSize *found_index, ZyanComparison comparison)ZYCORE_EXPORT ZyanStatus ZyanVectorBinarySearchEx (const ZyanVector *vector, const void *element, ZyanUSize *found_index, ZyanComparison comparison, ZyanUSize index, ZyanUSize count)ZYCORE_EXPORT ZyanStatus ZyanVectorResize (ZyanVector *vector, ZyanUSize size)ZYCORE_EXPORT ZyanStatus ZyanVectorResizeEx (ZyanVector *vector, ZyanUSize size, const void *initializer)ZYCORE_EXPORT ZyanStatus ZyanVectorReserve (ZyanVector *vector, ZyanUSize capacity)ZYCORE_EXPORT ZyanStatus ZyanVectorShrinkToFit (ZyanVector *vector)ZYCORE_EXPORT ZyanStatus ZyanVectorGetCapacity (const ZyanVector *vector, ZyanUSize *capacity)ZYCORE_EXPORT ZyanStatus ZyanVectorGetSize (const ZyanVector *vector, ZyanUSize *size)
π₯ Detailed Description
Implements the vector container class. That's it, that's the whole vibe β a growable, shrinkable, dynamically-allocated list of literally anything you want π
πΈ Macro Definition Documentation πΈ
#define ZYAN_VECTOR_DEFAULT_GROWTH_FACTOR 2
The default growth factor for all vector instances. It's giving "double it and give it to the next person" π
#define ZYAN_VECTOR_DEFAULT_SHRINK_THRESHOLD 4
The default shrink threshold for all vector instances.
#define ZYAN_VECTOR_FOREACH( type, vector, item_name, body)
Value:
{ \
const ZyanUSize ZYAN_MACRO_CONCAT_EXPAND(size_d50d3303, item_name) = (vector)->size; \
for (ZyanUSize ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name) = 0; \
ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name) < \
ZYAN_MACRO_CONCAT_EXPAND(size_d50d3303, item_name); \
++ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name)) \
{ \
const type item_name = ZYAN_VECTOR_GET(type, vector, \
ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name)); \
body \
} \
}
Loops through all elements of the vector. It's a little for loop glowed up with some extremely extra generated variable names so nothing collides β iconic behaviour honestly β¨
Parameters
- type β the desired value type.
- vector β a pointer to the
ZyanVectorinstance. - item_name β the name of the iterator item.
- body β the body to execute for each item in the vector.
#define ZYAN_VECTOR_FOREACH_MUTABLE( type, vector, item_name, body)
Value:
{ \
const ZyanUSize ZYAN_MACRO_CONCAT_EXPAND(size_d50d3303, item_name) = (vector)->size; \
for (ZyanUSize ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name) = 0; \
ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name) < \
ZYAN_MACRO_CONCAT_EXPAND(size_d50d3303, item_name); \
++ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name)) \
{ \
type* const item_name = ZyanVectorGetMutable(vector, \
ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name)); \
body \
} \
}
Loops through all elements of the vector. Same energy as ZYAN_VECTOR_FOREACH, except this one hands you a pointer, so you can actually change stuff. Main character energy, go off π
Parameters
- type β the desired value type.
- vector β a pointer to the
ZyanVectorinstance. - item_name β the name of the iterator item.
- body β the body to execute for each item in the vector.
#define ZYAN_VECTOR_GET( type, vector, index)
Value:
(*(const type*)ZyanVectorGet(vector, index))
Returns the value of the element at the given index. One-line wonder π«Ά
Parameters
- type β the desired value type.
- vector β a pointer to the
ZyanVectorinstance. - index β the element index.
Returns
The value of the desired element in the vector.
β οΈ Bestie, listen: note that this function is unsafe and might dereference a null-pointer. It does zero vibe checks on your input. Be careful fr fr π
#define ZYAN_VECTOR_INITIALIZER
Value:
{ \
/* allocator */ ZYAN_NULL, \
/* growth_factor */ 0, \
/* shrink_threshold */ 0, \
/* size */ 0, \
/* capacity */ 0, \
/* element_size */ 0, \
/* destructor */ ZYAN_NULL, \
/* data */ ZYAN_NULL \
}
Defines an uninitialized ZyanVector instance. Just a big ol' pile of zeros and nulls waiting for its moment π±
#define ZYAN_VECTOR_MIN_CAPACITY 1
The initial minimum capacity (number of elements) for all dynamically allocated vector instances.
π¦ Typedef Documentation π¦
typedef struct ZyanVector_ ZyanVector
Defines the ZyanVector struct.
π All fields in this struct should be considered as "private". Any changes may lead to unexpected behavior. So like... hands off the internals, okay? The struct is not your diary, no reading, no writing π
β Function Documentation β
ZYCORE_EXPORT ZyanStatus ZyanVectorBinarySearch (const ZyanVector * vector, const void * element, ZyanUSize * found_index, ZyanComparison comparison)
Searches for the first occurrence of element in the given vector using a binary-search algorithm. Divide and conquer, but make it cute β¨
Parameters
- vector β a pointer to the
ZyanVectorinstance. - element β a pointer to the element to search for.
- found_index β a pointer to a variable that receives the index of the found element.
- comparison β the comparison function to use.
Returns
ZYAN_STATUS_TRUE if the element was found, ZYAN_STATUS_FALSE if not, or a generic zyan status code if an error occurred.
If found, found_index contains the zero-based index of element. If not found, found_index contains the index of the first entry larger than element.
π¨ This function requires all elements in the vector to be strictly ordered (sorted). If they're not sorted, the whole thing falls apart and it's not giving what you want it to give. Sort first, search later, periodt π
ZYCORE_EXPORT ZyanStatus ZyanVectorBinarySearchEx (const ZyanVector * vector, const void * element, ZyanUSize * found_index, ZyanComparison comparison, ZyanUSize index, ZyanUSize count)
Searches for the first occurrence of element in the given vector using a binary-search algorithm β the deluxe edition, because now you get to say where to look π
Parameters
- vector β a pointer to the
ZyanVectorinstance. - element β a pointer to the element to search for.
- found_index β a pointer to a variable that receives the index of the found element.
- comparison β the comparison function to use.
- index β the start index.
- count β the maximum number of elements to iterate, beginning from the start index.
Returns
ZYAN_STATUS_TRUE if the element was found, ZYAN_STATUS_FALSE if not, or a generic zyan status code if an error occurred.
If found, found_index contains the zero-based index of element. If not found, found_index contains the index of the first entry larger than element.
π¨ Again: this function requires all elements in the vector to be strictly ordered (sorted). No sorted data, no binary search. Rules are rules π
ZYCORE_EXPORT ZyanStatus ZyanVectorClear (ZyanVector * vector)
Erases all elements of the given vector. Poof. Gone. Not a single one left π
Parameters
- vector β a pointer to the
ZyanVectorinstance.
Returns
A zyan status code.
ZYCORE_EXPORT ZyanStatus ZyanVectorDelete (ZyanVector * vector, ZyanUSize index)
Deletes the element at the given index of the vector. Bye bestie, we hardly knew ye π
Parameters
- vector β a pointer to the
ZyanVectorinstance. - index β the element index.
Returns
A zyan status code.
ZYCORE_EXPORT ZyanStatus ZyanVectorDeleteRange (ZyanVector * vector, ZyanUSize index, ZyanUSize count)
Deletes multiple elements from the given vector, starting at index.
Alright bestie, buckle up, we're in the function-docs zone and there are SO many of them π
So for that one above β the params, for the record:
vectorβ a pointer to theZyanVectorinstance.indexβ the index of the first element to delete.countβ the number of elements to delete.
And it hands back a zyan status code. Standard.
ZyanVectorDestroy π
ZYCORE_EXPORT ZyanStatus ZyanVectorDestroy (ZyanVector * vector)
Destroys the given ZyanVector instance. yeets it into the void, respectfully π«Ά
Parameters:
vectorβ a pointer to theZyanVectorinstance.
Returns: a zyan status code.
ZyanVectorDuplicate β¨
ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanVectorDuplicate (ZyanVector * destination, const ZyanVector * source, ZyanUSize capacity)
Initializes a brand new ZyanVector instance by duplicating an existing vector. it's giving copy-paste but make it iconic π
Parameters:
destinationβ a pointer to the (uninitialized) destinationZyanVectorinstance.sourceβ a pointer to the source vector.capacityβ the initial capacity (number of elements).- This value is automatically adjusted to the size of the source vector, if a smaller value was passed.
Returns: a zyan status code.
The memory for the vector is dynamically allocated by the default allocator using the default growth factor and the default shrink threshold.
Finalization with ZyanVectorDestroy is required for all instances created by this function. don't forget it, bestie, that's a leak otherwise π
ZyanVectorDuplicateCustomBuffer π
ZYCORE_EXPORT ZyanStatus ZyanVectorDuplicateCustomBuffer (ZyanVector * destination, const ZyanVector * source, void * buffer, ZyanUSize capacity)
Initializes a new ZyanVector instance by duplicating an existing vector, and configures it to use a custom user defined buffer with a fixed size. your buffer, your rules, periodt.
Parameters:
destinationβ a pointer to the (uninitialized) destinationZyanVectorinstance.sourceβ a pointer to the source vector.bufferβ a pointer to the buffer that is used as storage for the elements.capacityβ the maximum capacity (number of elements) of the buffer.- This function will fail, if the capacity of the buffer is less than the size of the source vector.
Returns: a zyan status code.
Finalization is not required for instances created by this function. no cleanup era, we love that πΈ
ZyanVectorDuplicateEx π
ZYCORE_EXPORT ZyanStatus ZyanVectorDuplicateEx (ZyanVector * destination, const ZyanVector * source, ZyanUSize capacity, ZyanAllocator * allocator, ZyanU8 growth_factor, ZyanU8 shrink_threshold)
Initializes a new ZyanVector instance by duplicating an existing vector, and sets a custom allocator plus your own memory allocation/deallocation parameters. full customization, main character energy only.
Parameters:
destinationβ a pointer to the (uninitialized) destinationZyanVectorinstance.sourceβ a pointer to the source vector.capacityβ the initial capacity (number of elements).- This value is automatically adjusted to the size of the source vector, if a smaller value was passed.
allocatorβ a pointer to aZyanAllocatorinstance.growth_factorβ the growth factor.shrink_thresholdβ the shrink threshold.
Returns: a zyan status code.
A growth_factor of 1 disables overallocation, and a shrink_threshold of 0 disables dynamic shrinking. iykyk π§
Finalization with ZyanVectorDestroy is required for all instances created by this function.
ZyanVectorEmplace π₯
ZYCORE_EXPORT ZyanStatus ZyanVectorEmplace (ZyanVector * vector, void ** element, ZyanMemberFunction constructor)
Constructs an element in-place at the end of the vector. building it right there on the spot, no cap.
Parameters:
vectorβ a pointer to theZyanVectorinstance.elementβ receives a pointer to the new element.constructorβ the constructor callback orZYAN_NULL. The new element will be in undefined state, if no constructor was passed.
Returns: a zyan status code.
ZyanVectorEmplaceEx β
ZYCORE_EXPORT ZyanStatus ZyanVectorEmplaceEx (ZyanVector * vector, ZyanUSize index, void ** element, ZyanMemberFunction constructor)
Constructs an element in-place and inserts it at the given index of the vector. fancy placement, honestly iconic.
Parameters:
vectorβ a pointer to theZyanVectorinstance.indexβ the insert index.elementβ receives a pointer to the new element.constructorβ the constructor callback orZYAN_NULL. The new element will be in undefined state, if no constructor was passed.
Returns: a zyan status code.
ZyanVectorFind π
ZYCORE_EXPORT ZyanStatus ZyanVectorFind (const ZyanVector * vector, const void * element, ZyanISize * found_index, ZyanEqualityComparison comparison)
Sequentially searches for the first occurrence of element in the given vector. one by one, no skipping π
Parameters:
vectorβ a pointer to theZyanVectorinstance.elementβ a pointer to the element to search for.found_indexβ a pointer to a variable that receives the index of the found element.comparisonβ the comparison function to use.
Returns: ZYAN_STATUS_TRUE if the element was found, ZYAN_STATUS_FALSE if not, or a generic zyan status code if an error occurred.
The found_index is set to -1, if the element was not found. ghosted, basically π»
ZyanVectorFindEx π
ZYCORE_EXPORT ZyanStatus ZyanVectorFindEx (const ZyanVector * vector, const void * element, ZyanISize * found_index, ZyanEqualityComparison comparison, ZyanUSize index, ZyanUSize count)
Sequentially searches for the first occurrence of element in the given vector. same vibe, but now you get to say where to start and how far to go.
Parameters:
vectorβ a pointer to theZyanVectorinstance.elementβ a pointer to the element to search for.found_indexβ a pointer to a variable that receives the index of the found element.comparisonβ the comparison function to use.indexβ the start index.countβ the maximum number of elements to iterate, beginning from the start index.
Returns: ZYAN_STATUS_TRUE if the element was found, ZYAN_STATUS_FALSE if not, or a generic zyan status code if an error occurred.
The found_index is set to -1, if the element was not found.
ZyanVectorGet π
ZYCORE_EXPORT const void * ZyanVectorGet (const ZyanVector * vector, ZyanUSize index)
Returns a constant pointer to the element at the given index.
Parameters:
vectorβ a pointer to theZyanVectorinstance.indexβ the element index.
Returns: a constant pointer to the desired element in the vector or ZYAN_NULL, if an error occurred.
Heads up bestie: the returned pointer might get invalid when the vector is resized β either by a manual call to the memory-management functions, or implicitly by inserting or removing elements. so don't go hoarding it π
If you need a function that returns a zyan status code instead, take a look at ZyanVectorGetPointer.
ZyanVectorGetCapacity π
ZYCORE_EXPORT ZyanStatus ZyanVectorGetCapacity (const ZyanVector * vector, ZyanUSize * capacity)
Returns the current capacity of the vector.
Parameters:
vectorβ a pointer to theZyanVectorinstance.capacityβ receives the size of the vector.
Returns: a zyan status code.
ZyanVectorGetMutable π
ZYCORE_EXPORT void * ZyanVectorGetMutable (const ZyanVector * vector, ZyanUSize index)
Returns a mutable pointer to the element at the given index. now you can actually change stuff π
Parameters:
vectorβ a pointer to theZyanVectorinstance.indexβ the element index.
Returns: a mutable pointer to the desired element in the vector or ZYAN_NULL, if an error occurred.
Same warning as before: the returned pointer might get invalid when the vector is resized by either a manual call to the memory-management functions or implicitly by inserting or removing elements.
If you need a function that returns a zyan status code, take a look at ZyanVectorGetPointerMutable instead.
ZyanVectorGetPointer π«Ά
ZYCORE_EXPORT ZyanStatus ZyanVectorGetPointer (const ZyanVector * vector, ZyanUSize index, const void ** value)
Returns a constant pointer to the element at the given index.
Parameters:
vectorβ a pointer to theZyanVectorinstance.indexβ the element index.valueβ receives a constant pointer to the desired element in the vector.
And again, for the people in the back: the returned pointer might get invalid when the vector is resized by either a manual call to the memory-management functions or implicitly by inserting or removing elements.
Returns: a zyan status code.
ZyanVectorGetPointerMutable π
ZYCORE_EXPORT ZyanStatus ZyanVectorGetPointerMutable (const ZyanVector * vector, ZyanUSize index, void ** value)
Returns a mutable pointer to the element at the given index.
Parameters:
vectorβ a pointer to theZyanVectorinstance.indexβ the element index.valueβ receives a mutable pointer to the desired element in the vector.
You already know: the returned pointer might get invalid when the vector is resized by either a manual call to the memory-management functions or implicitly by inserting or removing elements.
Returns: a zyan status code.
ZyanVectorGetSize π
ZYCORE_EXPORT ZyanStatus ZyanVectorGetSize (const ZyanVector * vector, ZyanUSize * size)
Returns the current size of the vector.
Parameters:
vectorβ a pointer to theZyanVectorinstance.sizeβ receives the size of the vector.
Returns: a zyan status code.
ZyanVectorInit π
ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanVectorInit (ZyanVector * vector, ZyanUSize element_size, ZyanUSize capacity, ZyanMemberProcedure destructor)
Initializes the given ZyanVector instance. fresh start, blank slate, new era β¨
Parameters:
vectorβ a pointer to theZyanVectorinstance.element_sizeβ the size of a single element in bytes.capacityβ the initial capacity (number of elements).destructorβ a destructor callback that is invoked every time an item is deleted, orZYAN_NULLif not needed.
Returns: a zyan status code.
The memory for the vector elements is dynamically allocated by the default allocator using the default growth factor and the default shrink threshold.
Finalization with ZyanVectorDestroy is required for all instances created by this function. write that down π
ZyanVectorInitCustomBuffer π§Ί
ZYCORE_EXPORT ZyanStatus ZyanVectorInitCustomBuffer (ZyanVector * vector, ZyanUSize element_size, void * buffer, ZyanUSize capacity, ZyanMemberProcedure destructor)
Initializes the given ZyanVector instance and configures it to use a custom user defined buffer with a fixed size. bring your own storage, we stan.
Parameters:
vectorβ a pointer to theZyanVectorinstance.element_sizeβ the size of a single element in bytes.bufferβ a pointer to the buffer that is used as storage for the elements.capacityβ the maximum capacity (number of elements) of the buffer.destructorβ a destructor callback that is invoked every time an item is deleted, orZYAN_NULLif not needed.
Returns: a zyan status code.
Finalization is not required for instances created by this function. no ZyanVectorDestroy needed, slay π
ZyanVectorInitEx π«
ZYCORE_EXPORT ZyanStatus ZyanVectorInitEx (ZyanVector * vector, ZyanUSize element_size, ZyanUSize capacity, ZyanMemberProcedure destructor, ZyanAllocator * allocator, ZyanU8 growth_factor, ZyanU8 shrink_threshold)
Initializes the given ZyanVector instance and sets a custom allocator and memory allocation/deallocation parameters.
Parameters πΈ
vectorβ a pointer to theZyanVectorinstance.element_sizeβ the size of a single element in bytes.capacityβ the initial capacity (number of elements).destructorβ a destructor callback that is invoked every time an item is deleted, orZYAN_NULLif not needed.allocatorβ a pointer to aZyanAllocatorinstance.growth_factorβ the growth factor.shrink_thresholdβ the shrink threshold.
Returns β¨
A zyan status code. that's the tea.
Agrowth_factorof1disables overallocation, and ashrink_thresholdof0disables dynamic shrinking. iykyk. π
Finalization with ZyanVectorDestroy is required for all instances created by this function. no cap, you have to clean up after yourself. π«Ά
ZyanVectorInsert π
ZYCORE_EXPORT ZyanStatus ZyanVectorInsert (ZyanVector * vector, ZyanUSize index, const void * element)
Inserts an element at the given index of the vector. slay.
Parameters:
vectorβ a pointer to theZyanVectorinstance.indexβ the insert index.elementβ a pointer to the element to insert.
Returns:
A zyan status code.
ZyanVectorInsertRange β¨
ZYCORE_EXPORT ZyanStatus ZyanVectorInsertRange (ZyanVector * vector, ZyanUSize index, const void * elements, ZyanUSize count)
Inserts multiple elements at the given index of the vector. group-chat energy fr fr.
Parameters:
vectorβ a pointer to theZyanVectorinstance.indexβ the insert index.elementsβ a pointer to the first element.countβ the number of elements to insert.
Returns:
A zyan status code.
ZyanVectorPopBack π
ZYCORE_EXPORT ZyanStatus ZyanVectorPopBack (ZyanVector * vector)
Removes the last element of the vector. bye bye bestie.
Parameters:
vectorβ a pointer to theZyanVectorinstance.
Returns:
A zyan status code.
ZyanVectorPushBack π
ZYCORE_EXPORT ZyanStatus ZyanVectorPushBack (ZyanVector * vector, const void * element)
Adds a new element to the end of the vector. main character energy.
Parameters:
vectorβ a pointer to theZyanVectorinstance.elementβ a pointer to the element to add.
Returns:
A zyan status code.
ZyanVectorReserve π
ZYCORE_EXPORT ZyanStatus ZyanVectorReserve (ZyanVector * vector, ZyanUSize capacity)
Changes the capacity of the given ZyanVector instance. make room, periodt.
Parameters:
vectorβ a pointer to theZyanVectorinstance.capacityβ the new minimum capacity of the vector.
Returns:
A zyan status code.
ZyanVectorResize πΈ
ZYCORE_EXPORT ZyanStatus ZyanVectorResize (ZyanVector * vector, ZyanUSize size)
Resizes the given ZyanVector instance. glow up or glow down, your call.
Parameters:
vectorβ a pointer to theZyanVectorinstance.sizeβ the new size of the vector.
Returns:
A zyan status code.
ZyanVectorResizeEx π
ZYCORE_EXPORT ZyanStatus ZyanVectorResizeEx (ZyanVector * vector, ZyanUSize size, const void * initializer)
Resizes the given ZyanVector instance. this one lets you pass an initializer, cute.
Parameters:
vectorβ a pointer to theZyanVectorinstance.sizeβ the new size of the vector.initializerβ a pointer to a value to be used as initializer for new items.
Returns:
A zyan status code.
ZyanVectorSet π¦
ZYCORE_EXPORT ZyanStatus ZyanVectorSet (ZyanVector * vector, ZyanUSize index, const void * value)
Assigns a new value to the element at the given index. swap the vibe, keep the spot.
Parameters:
vectorβ a pointer to theZyanVectorinstance.indexβ the value index.valueβ the value to assign.
Returns:
A zyan status code.
ZyanVectorShrinkToFit β¨
ZYCORE_EXPORT ZyanStatus ZyanVectorShrinkToFit (ZyanVector * vector)
Shrinks the capacity of the given vector to match it's size. yes, the original says it's β we keep it exactly, bestie. grammar is not the vibe here.
Parameters:
vectorβ a pointer to theZyanVectorinstance.
Returns:
A zyan status code.
ZyanVectorSwapElements π₯
ZYCORE_EXPORT ZyanStatus ZyanVectorSwapElements (ZyanVector * vector, ZyanUSize index_first, ZyanUSize index_second)
Swaps the element at index_first with the element at index_second. trade places, periodt.
Parameters:
vectorβ a pointer to theZyanVectorinstance.index_firstβ the index of the first element.index_secondβ the index of the second element.
Returns:
A zyan status code.
This function requires the vector to have spare capacity for one temporary element. Call ZyanVectorReserve before this function to increase capacity, if needed. no cap, plan ahead. π
Author π
Generated automatically by Doxygen for Zycore from the source code. iconic.
And that's the whole page, bestie. This came from Zycore Version 1.5.2.0, the include/Zycore/Vector.h(3) manual page. πβ¨
π¦ where this page comes from
- ubuntu resolute: libzycore-doc 1.5.2-1build1 Β· MIT
- ubuntu stonking: libzycore-doc 1.5.2-1build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms