VecLast
Description
Last element of the vector by value. Caller must ensure the vector is non-empty.
Parameters
| Name | Direction | Description |
|---|---|---|
v |
in | Vector to query. |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Graph.c:289:
while (VecLen(neighbors)) {
GraphNodeId to = VecLast(neighbors);
if (!graph_remove_edge_now(graph, from, to)) {
LOG_FATAL("Graph failed to remove outgoing edge during node deletion");- In
VecCharPtr.c:148:
case VEC_CHAR_PTR_LAST : {
if (VecLen(vec) > 0) {
char *last = VecLast(vec);
(void)last; // Use the result to avoid warnings
}- In
VecStr.c:170:
case VEC_STR_LAST : {
if (VecLen(vec) > 0) {
Str last = VecLast(vec);
(void)last; // Use the result to avoid warnings
}- In
VecInt.c:116:
case VEC_INT_LAST : {
if (VecLen(vec) > 0) {
volatile i32 last = VecLast(vec);
(void)last;
}- In
Vec.Access.c:101:
// Test VecFirst and VecLast functions
bool test_vec_first_last(void) {
WriteFmt("Testing VecFirst and VecLast\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Vec.Access.c:116:
// Check first and last elements
bool result = (VecFirst(&vec) == 10);
result = result && (VecLast(&vec) == 30);
// Modify first and last elements
- In
Vec.Access.c:120:
// Modify first and last elements
VecFirst(&vec) = 15;
VecLast(&vec) = 35;
// Verify changes
- In
Access.h:79:
/// TAGS: Str, Access, Last
///
#define StrLast(str) VecLast(str)
///
Last updated on