Cthulhu  0.2.10
Cthulhu compiler collection
vector.h File Reference
#include <ctu_std_api.h>
#include "core/analyze.h"
#include "core/compiler.h"
#include <stddef.h>
Include dependency graph for vector.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  typevec_t
 A vector with a fixed type size. More...
 

Functions

CT_STD_API void typevec_init (typevec_t *vec, size_t width, size_t len, arena_t *arena)
 initialize a typed vector More...
 
CT_STD_API typevec_t typevec_make (size_t width, size_t len, arena_t *arena)
 create a new typed vector on the stack More...
 
CT_NODISCARD CT_STD_API typevec_ttypevec_new (size_t width, size_t len, arena_t *arena)
 create a new typed vector on the heap More...
 
CT_NODISCARD CT_STD_API typevec_ttypevec_of (size_t width, size_t len, arena_t *arena)
 create a new typed vector with an initial size and length More...
 
CT_NODISCARD CT_STD_API typevec_ttypevec_of_array (size_t width, STA_READS(count *width) const void *src, size_t count, arena_t *arena)
 create a new typed vector from an array this copies count * width bytes from src to the vector More...
 
CT_NODISCARD CT_STD_API typevec_ttypevec_slice (const typevec_t *vec, size_t start, size_t end)
 create a new typevec from an existing typevec More...
 
CT_NODISCARD CT_PUREFN CT_STD_API size_t typevec_len (const typevec_t *vec)
 get the length of a vector More...
 
CT_STD_API void typevec_set (typevec_t *vec, size_t index, const void *src)
 set an element in the vector More...
 
CT_STD_API void typevec_get (const typevec_t *vec, size_t index, STA_WRITES(vec->width) void *dst)
 get an element from the vector More...
 
CT_STD_API void typevec_tail (const typevec_t *vec, void *dst)
 get the last element from the vector More...
 
CT_STD_API void * typevec_push (typevec_t *vec, const void *src)
 push a value onto the vector More...
 
CT_STD_API void typevec_append (typevec_t *vec, const void *src, size_t len)
 append multiple values onto the vector More...
 
CT_STD_API void typevec_pop (typevec_t *vec, void *dst)
 pop a value from the vector More...
 
CT_NODISCARD CT_PUREFN CT_STD_API void * typevec_offset (const typevec_t *vec, size_t index)
 get a pointer to the value at the given index More...
 
CT_NODISCARD CT_PUREFN CT_STD_API void * typevec_data (const typevec_t *vec)
 get a pointer to the underlying data More...
 
CT_STD_API void typevec_sort (typevec_t *vec, int(*cmp)(const void *, const void *))
 sort a vector More...
 
CT_STD_API void typevec_reset (typevec_t *vec)
 reset a vector More...
 

Variables

CT_STD_API const typevec_t kEmptyTypevec