VecPopFront
VecPopFront
Description
Pop item from vector front.
Parameters
| Name | Direction | Description |
|---|---|---|
v |
in,out | Vector to pop item from. |
ptr |
out | Popped item will be stored here. Make sure this has sufficient memory to store memcopied data. If no pointer is provided, then it’s equivalent to deleting item from last position. |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
VecCharPtr.c:70:
if (VecLen(vec) > 0) {
char *str;
VecPopFront(vec, &str);
// char_ptr_deinit is called automatically by the vector
}- In
VecStr.c:72:
if (VecLen(vec) > 0) {
Str str;
VecPopFront(vec, &str);
// StrDeinit is called automatically by the vector
}- In
VecInt.c:52:
if (VecLen(vec) > 0) {
i32 popped;
VecPopFront(vec, &popped);
}
break;- In
Vec.Remove.c:77:
// Test VecPopFront function
bool test_vec_pop_front(void) {
WriteFmtLn("Testing VecPopFront");
// Create a vector of integers
- In
Vec.Remove.c:95:
// Pop from the front
int popped;
VecPopFront(&vec, &popped);
// Check popped value
- In
Vec.Remove.c:109:
// Pop again
VecPopFront(&vec, &popped);
// Check popped value
- In
Remove.h:40:
/// FAILURE : Returns NULL otherwise.
///
#define StrPopFront(str, chr) VecPopFront((str), (chr))
///
Last updated on