Cub3D
 
Loading...
Searching...
No Matches
Vector implementation with t_pos2

Vector functions used to work woth t_pos2. More...

Functions

t_posvecposvecnew (size_t size)
 Create a vector with an initial starting size.
 
int posvecpush (t_posvec *vec, t_pos2 data)
 Add a new element to the vector.
 
int posvecpop (t_posvec *vec, t_pos2 *pos)
 Pops the last element of the vector if not empty.
 
int posvecremove (t_posvec *vec, size_t index, t_pos2 *result)
 Removes the element at the specified index from the vector if found.
 
void posvecfree (t_posvec *vec)
 Free the vector.
 

Detailed Description

Vector functions used to work woth t_pos2.

Function Documentation

◆ posvecfree()

void posvecfree ( t_posvec * vec)

Free the vector.

Parameters
[in,out]vecvector pointer

◆ posvecnew()

t_posvec * posvecnew ( size_t size)

Create a vector with an initial starting size.

Parameters
[in]sizeinitial size
Returns
t_posvec* pointer to the new vector

◆ posvecpop()

int posvecpop ( t_posvec * vec,
t_pos2 * pos )

Pops the last element of the vector if not empty.

Parameters
[in,out]vecvector pointer
[in,out]posif non-null, copy the last element to this location
Returns
int 1 OK, 0 otherwise

◆ posvecpush()

int posvecpush ( t_posvec * vec,
t_pos2 data )

Add a new element to the vector.

Parameters
[in,out]vecvector pointer
[in]datapayload to add
Returns
int 1 OK, 0 otherwise

◆ posvecremove()

int posvecremove ( t_posvec * vec,
size_t index,
t_pos2 * result )

Removes the element at the specified index from the vector if found.

Parameters
[in,out]vecvector pointer
[in]indexindex of the element to define
[in,out]resultif non-null, copy the removed element to this location
Returns
int