33#define A_VEC_PTR(T, ctx) a_cast_s(T *, a_vec_ptr(ctx))
62 return a_byte_(*, ctx->
ptr_) + ctx->
siz_ * idx;
64#define A_VEC_AT_(T, ctx, idx) a_cast_s(T *, a_vec_at_(ctx, idx))
77#define A_VEC_AT(T, ctx, idx) a_cast_s(T *, a_vec_at(ctx, idx))
91#define A_VEC_IDX(T, ctx, idx) a_cast_s(T *, a_vec_idx(ctx, idx))
101 return a_byte_(*, ctx->
ptr_) + ctx->
siz_ * (ctx->
num_ - 1);
103#define A_VEC_TOP_(T, ctx) a_cast_s(T *, a_vec_top_(ctx))
115#define A_VEC_TOP(T, ctx) a_cast_s(T *, a_vec_top(ctx))
126#define A_VEC_END_(T, ctx) a_cast_s(T *, a_vec_end_(ctx))
138#define A_VEC_END(T, ctx) a_cast_s(T *, a_vec_end(ctx))
140#if defined(__cplusplus)
284#define A_VEC_PUSH_SORT(T, ctx, key, cmp) a_cast_s(T *, a_vec_push_sort(ctx, key, cmp))
297A_EXTERN
void *
a_vec_search(
a_vec const *ctx,
void const *obj,
int (*cmp)(
void const *,
void const *));
298#define A_VEC_SEARCH(T, ctx, obj, cmp) a_cast_s(T *, a_vec_search(ctx, obj, cmp))
310#define A_VEC_INSERT(T, ctx, idx) a_cast_s(T *, a_vec_insert(ctx, idx))
322#define A_VEC_REMOVE(T, ctx, idx) a_cast_s(T *, a_vec_remove(ctx, idx))
331#define A_VEC_PUSH_FORE(T, ctx) a_cast_s(T *, a_vec_push_fore(ctx))
340#define A_VEC_PUSH_BACK(T, ctx) a_cast_s(T *, a_vec_push_back(ctx))
349#define A_VEC_PULL_FORE(T, ctx) a_cast_s(T *, a_vec_pull_fore(ctx))
358#define A_VEC_PULL_BACK(T, ctx) a_cast_s(T *, a_vec_pull_back(ctx))
360#if defined(__cplusplus)
371#define A_VEC_PUSH(T, ctx) a_cast_s(T *, a_vec_push(ctx))
380#define A_VEC_PULL(T, ctx) a_cast_s(T *, a_vec_pull(ctx))
394#define a_vec_forenum(i, ctx) a_forenum(a_size, i, (ctx)->num_)
408#define a_vec_forenum_reverse(i, ctx) a_forenum_reverse(a_size, i, (ctx)->num_)
423#define a_vec_foreach(T, P, it, ctx) a_forsafe(T, P, it, (ctx)->ptr_, (ctx)->num_)
438#define a_vec_foreach_reverse(T, P, it, ctx) a_forsafe_reverse(T, P, it, (ctx)->ptr_, (ctx)->num_)
void * a_vec_push_fore(a_vec *ctx)
push an element into the vector forward
struct a_vec a_vec
instance structure for basic vector
void * a_vec_end_(a_vec const *ctx)
access end pointer for a pointer to vector structure
Definition vec.h:122
void * a_vec_idx(a_vec const *ctx, ptrdiff_t idx)
access specified element for a pointer to vector structure
Definition vec.h:86
void * a_vec_pull(a_vec *ctx)
pull an element from the vector
Definition vec.h:379
void a_vec_die(a_vec *ctx, void(*dtor)(void *))
deallocate a pointer to vector structure
void a_vec_ctor(a_vec *ctx, size_t size)
constructor for vector structure
void a_vec_edit(a_vec *ctx, size_t size, void(*dtor)(void *))
edit size of a element for a pointer to vector structure
void a_vec_move(a_vec *ctx, a_vec *obj)
initialize a pointer to vector structure by moving
int a_vec_copy(a_vec *ctx, a_vec const *obj, int(*dup)(void *, void const *))
initialize a pointer to vector structure by copying
int a_vec_make(a_vec *ctx, size_t num, void(*dtor)(void *))
modify element number for a pointer to string structure
void * a_vec_push(a_vec *ctx)
push an element into the vector
Definition vec.h:370
void * a_vec_push_back(a_vec *ctx)
push an element into the vector backward
void a_vec_drop(a_vec *ctx, void(*dtor)(void *))
drop all the elements for a pointer to vector structure
void * a_vec_search(a_vec const *ctx, void const *obj, int(*cmp)(void const *, void const *))
search the given element in this vector
void * a_vec_push_sort(a_vec *ctx, void const *key, int(*cmp)(void const *, void const *))
push an element into the vector and sort it
void * a_vec_remove(a_vec *ctx, size_t idx)
remove an element from the vector
void a_vec_sort_back(a_vec const *ctx, int(*cmp)(void const *, void const *))
insert sort backmost element for a pointer to vector structure
void * a_vec_top_(a_vec const *ctx)
access top element for a pointer to vector structure
Definition vec.h:99
a_vec * a_vec_new(size_t size)
allocate a pointer to vector structure from memory
void a_vec_sort_fore(a_vec const *ctx, int(*cmp)(void const *, void const *))
insert sort foremost element for a pointer to vector structure
void * a_vec_at(a_vec const *ctx, size_t idx)
access specified element for a pointer to vector structure
Definition vec.h:73
void * a_vec_insert(a_vec *ctx, size_t idx)
insert an element into the vector
void * a_vec_top(a_vec const *ctx)
access top element for a pointer to vector structure
Definition vec.h:111
size_t a_vec_siz(a_vec const *ctx)
access size of a element for a pointer to vector structure
Definition vec.h:39
size_t a_vec_mem(a_vec const *ctx)
access memory of element for a pointer to vector structure
Definition vec.h:51
void * a_vec_at_(a_vec const *ctx, size_t idx)
access specified element for a pointer to vector structure
Definition vec.h:60
void * a_vec_ptr(a_vec const *ctx)
access address of vector for a pointer to vector structure
Definition vec.h:32
void a_vec_swap(a_vec const *ctx, size_t lhs, size_t rhs)
swap elements lhs and rhs for a pointer to vector structure
void a_vec_dtor(a_vec *ctx, void(*dtor)(void *))
destructor for vector structure
size_t a_vec_num(a_vec const *ctx)
access number of element for a pointer to vector structure
Definition vec.h:45
void * a_vec_pull_back(a_vec *ctx)
pull an element from the vector backward
void * a_vec_pull_fore(a_vec *ctx)
pull an element from the vector forward
void * a_vec_end(a_vec const *ctx)
access end pointer for a pointer to vector structure
Definition vec.h:134
void a_vec_sort(a_vec const *ctx, int(*cmp)(void const *, void const *))
sort all elements for a pointer to vector structure
#define a_size
Definition a.h:610
#define a_diff
Definition a.h:598
#define a_size_c(x)
Definition a.h:607
instance structure for basic vector
Definition vec.h:21
size_t num_
Definition vec.h:24
void * ptr_
Definition vec.h:22
size_t siz_
Definition vec.h:23
size_t mem_
Definition vec.h:25