14 typedef struct _Vector {
20 int32_t (*push_back) (
struct _Vector*, Item);
24 int32_t (*insert) (
struct _Vector*, Item, int32_t);
28 int32_t (*pop_back) (
struct _Vector*);
32 int32_t (*
delete) (
struct _Vector*, int32_t);
36 int32_t (*set) (
struct _Vector*, Item, int32_t);
40 int32_t (*
get) (
struct _Vector*, Item*, int32_t);
44 int32_t (*resize) (
struct _Vector*, int32_t);
48 int32_t (*size) (
struct _Vector*);
52 int32_t (*capacity) (
struct _Vector*);
56 int32_t (*sort) (
struct _Vector*, int32_t (*) (
const void*,
const void*));
60 int32_t (*iterate) (
struct _Vector*, bool, Item*);
64 int32_t (*reverse_iterate) (
struct _Vector*, bool, Item*);
68 int32_t (*set_destroy) (
struct _Vector*, void (*) (Item));
260 int32_t
VectorSort(
Vector *
self, int32_t (*pFunc) (
const void*,
const void*));
int32_t VectorInsert(Vector *self, Item item, int32_t iIdx)
Insert an item to the designated index of the vector.
void VectorDeinit(Vector **ppObj)
The destructor for Vector.
int32_t VectorDelete(Vector *self, int32_t iIdx)
Delete an item from the designated index of the vector.
int32_t VectorSetDestroy(Vector *self, void(*pFunc)(Item))
Set the custom item resource clean method.
int32_t VectorIterate(Vector *self, bool bReset, Item *pItem)
Iterate through the vector till the tail end.
int32_t VectorSort(Vector *self, int32_t(*pFunc)(const void *, const void *))
Sort the items via the designated item comparison method.
int32_t VectorPushBack(Vector *self, Item item)
Push an item to the tail of the vector.
struct _VectorData VectorData
VectorData is the data type for the container private information.
int32_t VectorPopBack(Vector *self)
Pop an item from the tail of the vector.
The implementation for dynamically growable array.
int32_t VectorInit(Vector **ppObj, int32_t iCap)
The constructor for Vector.
int32_t VectorSize(Vector *self)
Return the number of stored items.
int32_t VectorResize(Vector *self, int32_t iCap)
Change the container capacity.
int32_t VectorReverseIterate(Vector *self, bool bReset, Item *pItem)
Reversely iterate through the vector till the head end.
int32_t VectorGet(Vector *self, Item *pItem, int32_t iIdx)
Get an item from the designated index of the vector.
VectorData * pData
The container private information.
int32_t VectorSet(Vector *self, Item item, int32_t iIdx)
Set an item at the designated index of the vector.
int32_t VectorCapacity(Vector *self)
Return the container capacity.