Skip to content

Vec

Description

Typesafe vector definition. This is much like C++ template std::vector

Using this directly like Vec(T) won’t always work, because each time this is used it defines a new type, and two Vec(T)s are different from each other.

To deal with this, you must typedef vector for a specific type. Throughout the code, any time that is in plural form is generally a vector. Like Strs is a typedef of Vec(Str).

Fields

Name Description
length Number of items currently in vector (always <= capacity)
capacity Max number of items this vector can hold before doing a resize.
copy_init If provided then is used to create owned copies of items into vector.
copy_deinit If provided then is used to deinit data held by vector. Caution when dealing with shared ownership.
data Data held by vector. Don’t access by direct indexing. Use VecAt(..)
allocator Allocator bound to this vector. Its alignment field governs the alignment of the underlying buffer base only; the per-element stride is always sizeof(T). NULL for stack-init vecs (VecInitStack / StrInitStack): the macro plants an _Alignas(T) char[] backing buffer, and any operation that would grow the vec aborts via VecReserve.

Usage example (from documentation)

  Vec(int) integers; // Vector of integers
  Vec(CustomStruct) my_data; // Vector of CustomStruct
  Vec(float) real_numbers; // Vector of float values
  Vec(Zstr) names; Vector of c-style null-terminated strings

Usage example (Cross-references)

Usage examples (Cross-references)
    
    #include <Misra/Std/Allocator.h>
    #include <Misra/Std/Container/Vec/Type.h>
    #include <Misra/Types.h>
    /// canonical Cstr / Zstr / unsuffixed-Str overload family.
    typedef const char *Zstr;
    typedef Vec(Zstr) Zstrs;
    
    ///
    #include <Misra/Std/Allocator.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/File.h>
    #include <Misra/Std/Zstr.h>
        } ArgSpec;
    
        typedef Vec(ArgSpec) ArgSpecs;
    
        ///
    #include <Misra/Std/Container/Buf.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    
    #if FEATURE_BITVEC
    #define MISRA_STD_UTILITY_STR_ITER_H
    
    #include <Misra/Std/Container/Vec/Type.h>
    #include <Misra/Std/Zstr.h>
    #include <Misra/Std/Utility/Iter.h>
    
    typedef Iter(char) StrIter;
    typedef Vec(StrIter) StrIters;
    
    ///
    #define MISRA_STD_CONTAINER_BUF_H
    
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Memory.h>
    #include <Misra/Std/Utility/Iter.h>
    #include <Misra/Types.h>
    
    typedef Vec(u8) Buf;
    
    /// Iterator over an immutable byte buffer. Layout matches `Iter(const u8)`
    
    // clang-format off
    #include "Vec/Type.h"
    #include "Vec/Init.h"
    #include "Vec/Insert.h"
    // clang-format off
    #include "Vec/Type.h"
    #include "Vec/Init.h"
    #include "Vec/Insert.h"
    #include "Vec/Remove.h"
    #include "Vec/Type.h"
    #include "Vec/Init.h"
    #include "Vec/Insert.h"
    #include "Vec/Remove.h"
    #include "Vec/Access.h"
    #include "Vec/Init.h"
    #include "Vec/Insert.h"
    #include "Vec/Remove.h"
    #include "Vec/Access.h"
    #include "Vec/Memory.h"
    #include "Vec/Insert.h"
    #include "Vec/Remove.h"
    #include "Vec/Access.h"
    #include "Vec/Memory.h"
    #include "Vec/Foreach.h"
    #include "Vec/Remove.h"
    #include "Vec/Access.h"
    #include "Vec/Memory.h"
    #include "Vec/Foreach.h"
    #include "Vec/Ops.h"
    #include "Vec/Access.h"
    #include "Vec/Memory.h"
    #include "Vec/Foreach.h"
    #include "Vec/Ops.h"
    #include "Vec/Private.h"
    #include "Vec/Memory.h"
    #include "Vec/Foreach.h"
    #include "Vec/Ops.h"
    #include "Vec/Private.h"
    // clang-format on
    #include "Vec/Foreach.h"
    #include "Vec/Ops.h"
    #include "Vec/Private.h"
    // clang-format on
    #define MISRA_STD_CONTAINER_GRAPH_TYPE_H
    
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Types.h>
    /// TAGS: Graph, Edge, Neighbor, Vec
    ///
    typedef Vec(GraphNodeId) GraphNeighbors;
    
    ///
    } GenericGraphSlot;
    
    typedef Vec(GenericGraphSlot) GraphSlots;
    typedef Vec(u32) GraphFreeIndices;
    
    typedef Vec(GenericGraphSlot) GraphSlots;
    typedef Vec(u32) GraphFreeIndices;
    
    ///
    } GraphPendingEdgeRemoval;
    
    typedef Vec(GraphPendingEdgeRemoval) GraphPendingEdgeRemovals;
    
    typedef struct {
    #define Graph(T)                                                                                                       \
        struct {                                                                                                           \
            Vec(GraphSlot(T)) slots;                                                                                       \
            GraphFreeIndices         free_indices;                                                                         \
            GraphPendingEdgeRemovals pending_edge_removals;                                                                \
             UNPL(_s).done == 0;                                                                                           \
             MemSet(UNPL(_s).d, 0, sizeof(UNPL(_s).d)), UNPL(_s).done = 1)                                                 \
            for (Vec(T) name = {.length      = 0,                                                                          \
                                .capacity    = (ne),                                                                       \
                                .copy_init   = NULL,                                                                       \
    #include <Misra/Std/Container/Common.h>
    #include <Misra/Types.h>
    #include <Misra/Std/Container/Vec.h>
    
    ///
    } BitVec;
    
    typedef Vec(BitVec) BitVecs;
    
    ///
    /// TAGS: BitVec, Type, Match
    ///
    typedef Vec(size) BitVecMatchIndices;
    
    ///
    /// TAGS: BitVec, Type, Run
    ///
    typedef Vec(BitVecRun) BitVecRuns;
    
    #define BITVEC_MAGIC MAKE_NEW_MAGIC_VALUE("bitvectr")
    #define MISRA_STD_CONTAINER_STR_TYPE_H
    
    #include <Misra/Std/Container/Vec/Type.h>
    #include <Misra/Std/Utility/Iter/Type.h>
    #include <Misra/Types.h>
    /// TAGS: Str, Type, API
    ///
    typedef Vec(char) Str;
    
    ///
    /// TAGS: Str, Type, Vector
    ///
    typedef Vec(Str) Strs;
    
    ///
    #include <Misra/Std/Memory.h>
    #include <Misra/Std/Zstr.h>
    #include <Misra/Std/Container/Vec/Type.h>
    
    #ifdef __cplusplus
    
    #include "Type.h"
    #include <Misra/Std/Container/Vec/Insert.h>
    #include <Misra/Std/Zstr.h>
    
    #include "Type.h"
    #include <Misra/Std/Container/Vec/Access.h>
    
    #ifdef __cplusplus
    #include <Misra/Std/Container/Map.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Sys/Backtrace.h>
        } DebugFreedEntry;
    
        typedef Vec(DebugFreedEntry) DebugFreedVec;
    
        ///
    #include <Misra/Std/Allocator.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Types.h>
    /// TAGS: Backtrace, Type, Frame
    ///
    typedef Vec(StackFrame) StackFrames;
    
    // ---------------------------------------------------------------------------
    
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Zstr.h>
    /// Vector type for directory contents.
    ///
    typedef Vec(DirEntry) DirContents;
    
    // Path-arg dispatch. Library design: `Str *` is the canonical path
    #include <Misra/Std/Allocator.h>
    #include <Misra/Std/Container/Str/Type.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Types.h>
    } PdbCacheEntry;
    
    typedef Vec(PdbCacheEntry) PdbCacheEntries;
    
    typedef struct PdbCache {
    #endif
    #include <Misra/Std/Allocator.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Parsers/ProcMaps.h>
    #include <Misra/Types.h>
    } ResolverCacheEntry;
    
    typedef Vec(ResolverCacheEntry) ResolverCache;
    
    typedef struct SymbolResolver {
    #include <Misra/Std/Allocator.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Sys/Socket.h>
    #include <Misra/Types.h>
        } HostsEntry;
    
        typedef Vec(HostsEntry) HostsTable;
        typedef Vec(SocketAddr) DnsAddrs;
    
        typedef Vec(HostsEntry) HostsTable;
        typedef Vec(SocketAddr) DnsAddrs;
    
        ///
    #include <Misra/Std/Allocator.h>
    #include <Misra/Std/Container/Str/Type.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Types.h>
    } MachoCacheEntry;
    
    typedef Vec(MachoCacheEntry) MachoCacheEntries;
    
    typedef struct MachoCache {
    #define HttpHeaderInit_1(alloc_ptr) ((HttpHeader) {.key = StrInit_1(alloc_ptr), .value = StrInit_1(alloc_ptr)})
    
    typedef Vec(HttpHeader) HttpHeaders;
    
    ///
    #include <Misra/Std/Container/Buf.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Zstr.h>
    #include <Misra/Types.h>
    } PdbFunction;
    
    typedef Vec(PdbFunction) PdbFunctions;
    
    ///
    #include <Misra/Std/Allocator.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Types.h>
    } DwarfLineEntry;
    
    typedef Vec(DwarfLineEntry) DwarfLineEntries;
    
    ///
    } DwarfFde;
    
    typedef Vec(DwarfCie) DwarfCies;
    typedef Vec(DwarfFde) DwarfFdes;
    
    typedef Vec(DwarfCie) DwarfCies;
    typedef Vec(DwarfFde) DwarfFdes;
    
    ///
    } DwarfFunction;
    
    typedef Vec(DwarfFunction) DwarfFunctionEntries;
    
    ///
    #include <Misra/Std/Container/Buf.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Zstr.h>
    #include <Misra/Types.h>
    } ElfSegment;
    
    typedef Vec(ElfSection) ElfSections;
    typedef Vec(ElfSymbol) ElfSymbols;
    typedef Vec(ElfSegment) ElfSegments;
    
    typedef Vec(ElfSection) ElfSections;
    typedef Vec(ElfSymbol) ElfSymbols;
    typedef Vec(ElfSegment) ElfSegments;
    typedef Vec(ElfSection) ElfSections;
    typedef Vec(ElfSymbol) ElfSymbols;
    typedef Vec(ElfSegment) ElfSegments;
    
    ///
    #include <Misra/Std/Container/Buf.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Zstr.h>
    #include <Misra/Types.h>
    } PeSection;
    
    typedef Vec(PeSection) PeSections;
    
    ///
    #include <Misra/Std/Container/Buf.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Zstr.h>
    #include <Misra/Types.h>
    } MachoSymbol;
    
    typedef Vec(MachoSegment) MachoSegments;
    typedef Vec(MachoSection) MachoSections;
    typedef Vec(MachoSymbol) MachoSymbols;
    
    typedef Vec(MachoSegment) MachoSegments;
    typedef Vec(MachoSection) MachoSections;
    typedef Vec(MachoSymbol) MachoSymbols;
    typedef Vec(MachoSegment) MachoSegments;
    typedef Vec(MachoSection) MachoSections;
    typedef Vec(MachoSymbol) MachoSymbols;
    
    ///
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Buf.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Types.h>
        } DnsRecord;
    
        typedef Vec(DnsRecord) DnsRecords;
    
        ///
    #include <Misra/Std/Container/Buf.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/File.h>
    #include <Misra/Types.h>
    } ProcMapEntry;
    
    typedef Vec(ProcMapEntry) ProcMapEntries;
    
    typedef struct ProcMaps {
    #define FUZZ_VEC_STR_H
    
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Allocator/Default.h>
    
    // Vec(Str) typedef
    typedef Vec(Str) StrVec;
    
    // Vec(Str) function enumeration
    #include "../Harness.h"
    #include "VecInt.h"
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #define FUZZ_VEC_INT_H
    
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Allocator/Default.h>
    #include <Misra/Types.h>
    
    // Vec(i32) typedef
    typedef Vec(i32) IntVec;
    
    // Vec(i32) function enumeration
    #define FUZZ_VEC_CHAR_PTR_H
    
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Allocator/Default.h>
    #include <Misra/Types.h>
    
    // Vec(char*) typedef
    typedef Vec(char *) CharPtrVec;
    
    // Vec(char*) function enumeration
    #include "../Harness.h"
    #include "VecCharPtr.h"
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Std/Zstr.h>
    #include "../Harness.h"
    #include "VecStr.h"
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Std/Container/Str/Private.h>
    #include <Misra/Std/Zstr.h>
    #include <Misra/Std/Container/Vec/Private.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Types.h>
    
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Std/Memory.h>
    } AbbrevAttr;
    
    typedef Vec(AbbrevAttr) AbbrevAttrVec;
    
    typedef struct AbbrevEntry {
    } AbbrevEntry;
    
    typedef Vec(AbbrevEntry) AbbrevTable;
    
    static void abbrev_table_deinit(AbbrevTable *t) {
    } PendingFn;
    
    typedef Vec(PendingFn) PendingFns;
    
    static bool walk_cu_dies(
    } PendingPub;
    
    typedef Vec(PendingPub) PendingPubs;
    
    static i32 cmp_pending(const void *lhs, const void *rhs) {
    // Each `Vec(u64)` use is its own anonymous struct type, so a typedef
    // is required to pass these around between functions.
    typedef Vec(u64) U64Vec;
    
    // ---------------------------------------------------------------------------
    #include <Misra/Std/Allocator/Default.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Types.h> // For LVAL macro
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing swap rejects idx == length\n");
    
        typedef Vec(u32) U32Vec;
        U32Vec vec = VecInit(&alloc);
        for (u32 i = 0; i < 3; i++) {
        WriteFmt("Testing swap rejects idx1 == length (476:14)\n");
    
        typedef Vec(u32) U32Vec;
        U32Vec vec = VecInit(&alloc);
        for (u32 i = 0; i < 3; i++) {
    int main(void) {
        alloc = DefaultAllocatorInit();
        WriteFmt("[INFO] Starting Vec.Ops tests\n\n");
    
        // Array of test functions
    
        // Run all tests using the centralized test driver
        int rc = run_test_suite(tests, total_tests, deadend_tests, deadend_count, "Vec.Ops");
        DefaultAllocatorDeinit(&alloc);
        return rc;
    #include <Misra/Std/Allocator/Heap.h>
    #include <Misra/Std/Zstr.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Memory.h>
    #include <Misra/Std/Log.h>
    
        // Create a vector of ComplexItem with deep copy functions
        typedef Vec(ComplexItem) ComplexVec;
        ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);
    
        // Create a vector of ComplexItem with deep copy functions
        typedef Vec(ComplexItem) ComplexVec;
        ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);
    
        // Create a vector of ComplexItem with deep copy functions
        typedef Vec(ComplexItem) ComplexVec;
        ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);
    
        // Create two vectors of ComplexItem with deep copy functions
        typedef Vec(ComplexItem) ComplexVec;
        ComplexVec vec1 = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);
        ComplexVec vec2 = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit, &alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a temporary vector with no copy_init but with copy_deinit for proper cleanup
        typedef Vec(ComplexItem) ComplexVec;
        ComplexVec temp_vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
    
        // Create a vector with no copy_init but with copy_deinit for proper cleanup
        typedef Vec(ComplexItem) ComplexVec;
        ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
    
        // Create a vector with no copy_init but with copy_deinit for proper cleanup
        typedef Vec(ComplexItem) ComplexVec;
        ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
    
        // Create a vector with no copy_init but with copy_deinit for proper cleanup
        typedef Vec(ComplexItem) ComplexVec;
        ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
    
        // Create a vector with no copy_init but with copy_deinit for proper cleanup
        typedef Vec(ComplexItem) ComplexVec;
        ComplexVec vec1 = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
        ComplexVec vec2 = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
    
        // Create a vector with no copy_init but with copy_deinit for proper cleanup
        typedef Vec(ComplexItem) ComplexVec;
        ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit, &alloc);
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec src      = VecInit(&local);
        int    values[] = {1, 2, 3};
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec src      = VecInit(&local);
        int    values[] = {1, 2, 3};
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec src      = VecInit(&local);
        int    values[] = {1, 2, 3};
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec src      = VecInit(&local);
        int    values[] = {1, 2, 3};
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec src      = VecInit(&local);
        int    values[] = {1, 2, 3};
    int main(void) {
        alloc = DefaultAllocatorInit();
        WriteFmt("[INFO] Starting Vec.Complex tests\n\n");
    
        // Array of test functions
    
        // Run all tests using the centralized test driver
        int rc = run_test_suite(tests, total_tests, NULL, 0, "Vec.Complex");
        DefaultAllocatorDeinit(&alloc);
        return rc;
    #include <Misra/Std/Allocator/Heap.h>
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Std/Zstr.h>
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmtLn("Testing resize grow enlarges capacity (525:18)");
    
        typedef Vec(u32) U32Vec;
        U32Vec vec = VecInit(&alloc);
        reset_deinit_state();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);
        WriteFmtLn("Testing resize grow reserves backing capacity (531:14)");
    
        typedef Vec(u64) U64Vec;
        U64Vec vec = VecInit(&alloc);
        WriteFmtLn("Testing resize grow sets exact length (534:21)");
    
        typedef Vec(u32) U32Vec;
        U32Vec vec = VecInit(&alloc);
        WriteFmtLn("Testing reserve_pow2 rounds to a power of two (145:10)");
    
        typedef Vec(u32) U32Vec;
        U32Vec vec = VecInit(&alloc);
        HeapAllocator heap = HeapAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&heap);
        HeapAllocator heap = HeapAllocatorInit(); // alignment 1 -> aligned_size == 1
    
        typedef Vec(char) CharVec;
        CharVec vec = VecInit(&heap);
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(char) CharVec;
        CharVec vec = VecInit(&local);
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec vec      = VecInit(&local);
        vec.copy_deinit = (GenericCopyDeinit)clear_counting_deinit;
            u8  pad[60];
        } Wide; // sizeof == 64
        typedef Vec(Wide) WideVec;
        WideVec vec = VecInit(&local);
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&local);
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&local);
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&local);
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&local);
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&local);
            u8 bytes[(size)1 << 21];
        } Big;
        typedef Vec(Big) BigVec;
        BigVec vec = VecInit(&alloc);
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting Vec.Memory tests\n\n");
    
        alloc = DefaultAllocatorInit();
    
        // Run all tests using the centralized test driver
        int rc = run_test_suite(tests, total_tests, deadend_tests, deadend_count, "Vec.Memory");
        DefaultAllocatorDeinit(&alloc);
        return rc;
    #include <Misra/Std/Allocator/Default.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    
        // Test with int type
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Test with struct type
        typedef Vec(TestItem) TestVec;
        TestVec test_vec = VecInit(&alloc);
    
        // Test with int type and 4-byte alignment
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&aligned4);
    
        // Test with struct type and 16-byte alignment
        typedef Vec(TestItem) TestVec;
        TestVec test_vec = VecInit(&aligned16);
    
        // Test with struct type and custom copy/deinit functions
        typedef Vec(TestItem) TestVec;
        TestVec vec = VecInitWithDeepCopy(TestItemCopyInit, TestItemDeinit, &alloc);
    
        // Test with struct type, custom copy/deinit functions, and 8-byte alignment
        typedef Vec(TestItem) TestVec;
        TestVec vec = VecInitWithDeepCopy(TestItemCopyInit, TestItemDeinit, &aligned8);
        WriteFmt("Testing VecInit optional allocator\n");
    
        typedef Vec(TestItem) TestVec;
    
        // Build several heaps with distinct configuration; the test verifies
    
        // Create a source vector
        typedef Vec(int) IntVec;
        IntVec src = VecInit(&alloc);
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec vec      = VecInit(&local);
        vec.copy_deinit = (GenericCopyDeinit)counting_deinit;
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting Vec.Init tests\n\n");
    
        alloc = DefaultAllocatorInit();
    
        // Run all tests using the centralized test driver
        int rc = run_test_suite(tests, total_tests, NULL, 0, "Vec.Init");
        DefaultAllocatorDeinit(&alloc);
        return rc;
    #include <Misra/Std/Allocator/Debug.h>
    #include <Misra/Std/Allocator/Default.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Types.h> // For LVAL macro
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec1 = VecInit(&alloc);
        WriteFmt("Testing manual clone allocator inheritance\n");
    
        typedef Vec(int) IntVec;
    
        HeapAllocator local_heap = HeapAllocatorInit();
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers without copy_init
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing VecInsertRangeFast with count > (length - idx)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    } Elem;
    
    typedef Vec(Elem) ElemVec;
    
    // ---- copy_init / copy_deinit fixture instrumentation --------------------
        WriteFmt("Testing fast-insert grows when length+count reaches capacity\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing fast-insert grows at length+count == capacity boundary\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing fast-insert grows an empty vector\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing fast-insert honors reserve growth result\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    }
    
    typedef Vec(TrackItem) TrackVec;
    typedef Vec(u64) U64Vec;
    
    typedef Vec(TrackItem) TrackVec;
    typedef Vec(u64) U64Vec;
    
    // Build a TrackVec containing items with the given tags (copy_init never
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(u32) U32Vec;
        U32Vec vec = VecInit(&local);
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(u32) U32Vec;
        U32Vec vec = VecInit(&local);
        DefaultAllocator local = DefaultAllocatorInit();
    
        typedef Vec(u32) U32Vec;
        U32Vec vec = VecInit(&local);
    } MutElem;
    
    typedef Vec(MutElem) MutElemVec;
    
    // copy_init that fails on the very first call of an insert (armed via g_fail).
    int main(void) {
        alloc = DefaultAllocatorInit();
        WriteFmt("[INFO] Starting Vec.Insert tests\n\n");
    
        // Array of test functions
    
        // Run all tests using the centralized test driver
        int rc = run_test_suite(tests, total_tests, NULL, 0, "Vec.Insert");
        DefaultAllocatorDeinit(&alloc);
        return rc;
    #include <Misra/Std/Allocator/Default.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Types.h>
    // Test basic Vec type functionality
    bool test_vec_type_basic(void) {
        WriteFmt("Testing basic Vec type functionality\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
    
        // Define a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Test with a struct type
        typedef Vec(TestItem) TestVec;
        TestVec test_vec = VecInit(&alloc);
    
        // Create a valid vector
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting Vec.Type tests\n\n");
    
        // Array of test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, NULL, 0, "Vec.Type");
    }
    #include <Misra/Std/Allocator/Default.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    }
    
    typedef Vec(Elem) ElemVec;
    
    // Build a deinit-tracking vec holding elements with ids 0..n-1. copy_init is
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmtLn("Testing fast remove of whole vector (413:23)");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmtLn("Testing fast remove populates removed_data (418:72)");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmtLn("Testing fast remove removed_data byte count (418:74)");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        reset_deinit_state();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);
        reset_deinit_state();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);
        reset_deinit_state();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);
        reset_deinit_state();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);
        reset_deinit_state();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInitWithDeepCopy(NULL, counting_deinit, &alloc);
        WriteFmtLn("Testing fast remove zeroes vacated tail (449:40)");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmtLn("Testing fast remove tail-zero byte count (449:70)");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmtLn("Testing fast remove tail-zero stride call (449:72)");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing remove compaction length (first term, large start)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing remove compaction length (second term, large count)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing remove compaction stride (large over-move)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing remove tail-clear destination\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        for (int i = 0; i < 10; i++) {
        WriteFmt("Testing remove tail-clear length\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        for (int i = 0; i < 10; i++) {
        WriteFmt("Testing remove tail-clear stride (large over-write)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing remove compaction size (length - start term)\n");
    
        typedef Vec(u64) U64Vec;
        U64Vec vec = VecInit(&alloc);
        WriteFmt("Testing remove compaction size (- count term)\n");
    
        typedef Vec(u64) U64Vec;
        U64Vec vec = VecInit(&alloc);
    
        alloc  = DefaultAllocatorInit();
        int rc = run_test_suite(normal_tests, normal_count, NULL, 0, "Vec.Remove");
        DefaultAllocatorDeinit(&alloc);
        return rc;
    #include <Misra/Std/Allocator/Default.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing VecForeach where modification causes out of bounds access (should crash)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing VecForeachIdx where idx goes out of bounds (should crash)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing VecForeachReverseIdx where idx goes out of bounds (should crash)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing VecForeachPtrIdx where idx goes out of bounds (should crash)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing VecForeachPtrReverseIdx where idx goes out of bounds (should crash)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing VecForeachPtrInRangeIdx where idx goes out of bounds (should crash)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        WriteFmt("Testing basic VecForeachIdx where idx goes out of bounds (should crash)\n");
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    int main(void) {
        alloc = DefaultAllocatorInit();
        WriteFmt("[INFO] Starting Vec.Foreach.Simple tests\n\n");
    
        // Array of normal test functions
    
        // Run all tests using the centralized test driver
        int rc = run_test_suite(tests, total_tests, NULL, 0, "Vec.Foreach.Simple");
        DefaultAllocatorDeinit(&alloc);
        return rc;
    #include <Misra/Std/Allocator/Default.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Types.h>
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
    
        // Create a vector of integers
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        // Same self-consistency on a higher-alignment allocator: the stride is
        // still `sizeof(int)`, so VecSize and VecAlignedOffsetAt agree.
        typedef Vec(int) AlignedIntVec;
        AlignedIntVec aligned_vec = VecInit(&aligned8);
    
        // Create a vector of integers with default alignment (1)
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        // The element stride is `sizeof(T)` regardless of the allocator's base
        // alignment: the allocator governs only the buffer base, never the stride.
        typedef Vec(int) AlignedIntVec;
        AlignedIntVec aligned_vec = VecInit(&aligned8);
        DefaultAllocator alloc = DefaultAllocatorInit();
    
        typedef Vec(int) IntVec;
        IntVec vec = VecInit(&alloc);
        HeapAllocator alloc = HeapAllocatorInitAligned(16);
    
        typedef Vec(u32) U32Vec;
        U32Vec vec = VecInit(&alloc);
        DefaultAllocator alloc = DefaultAllocatorInit();
    
        typedef Vec(u32) U32Vec;
        U32Vec src      = VecInit(&alloc);
        u32    values[] = {10, 20, 30, 40};
    // Main function that runs all tests
    int main(void) {
        WriteFmt("[INFO] Starting Vec.Access tests\n\n");
    
        // Array of test functions
    
        // Run all tests using the centralized test driver
        return run_test_suite(tests, total_tests, NULL, 0, "Vec.Access");
    }
        Allocator       *base  = ALLOCATOR_OF(&alloc);
    
        WriteFmt("Testing BitVecRunLengths Vec form\n");
    
        BitVec bv = BitVecInit(base);
        Allocator       *base  = ALLOCATOR_OF(&alloc);
    
        WriteFmt("Testing BitVecFindAllPattern Vec form\n");
    
        BitVec source  = BitVecInit(base);
    #include <Misra/Std/Allocator.h>
    #include <Misra/Std/Allocator/Arena.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Io.h>
    #include <Misra/Std/Log.h>
    static bool test_vec_on_arena(void) {
        ArenaAllocator arena = ArenaAllocatorInit();
        typedef Vec(int) IntVec;
        IntVec v  = VecInit(&arena);
        bool   ok = true;
    #include <Misra/Std/Allocator.h>
    #include <Misra/Std/Allocator/Page.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Io.h>
    #include <Misra/Std/Log.h>
        // Exercises the internal descriptor table across multiple grows.
        PageAllocator alloc = PageAllocatorInit();
        typedef Vec(int) IntVec;
        IntVec v  = VecInit(&alloc);
        bool   ok = true;
    #include <Misra/Std/Allocator/Debug.h>
    #include <Misra/Std/Allocator/Default.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Memory.h>
    #include <Misra/Sys/SymbolResolver.h>
        Str name;
        f64 price;
        Vec(Str) tags;
    } SimpleProduct;
        StrIter si      = StrIterFromStr(json);
    
        Vec(Str) languages = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
    
        JR_OBJ(si, {
        Str  json    = StrInit(&alloc);
    
        Vec(i32) empty_numbers = VecInit(&alloc);
        Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
    
        Vec(i32) empty_numbers = VecInit(&alloc);
        Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
    
        JW_OBJ(json, {
        Str  json    = StrInit(&alloc);
    
        Vec(i32) empty_list = VecInit(&alloc);
    
        JW_OBJ(json, {
        Str  json    = StrInit(&alloc);
    
        Vec(i32) empty_arr  = VecInit(&alloc);
        Vec(i32) filled_arr = VecInit(&alloc);
        i32 val1 = 1, val2 = 2;
    
        Vec(i32) empty_arr  = VecInit(&alloc);
        Vec(i32) filled_arr = VecInit(&alloc);
        i32 val1 = 1, val2 = 2;
        VecPushBack(&filled_arr, val1);
    } AnnSymbol;
    
    typedef Vec(AnnSymbol) AnnSymbols;
    
    typedef struct ApiResponse {
        u64 analysis_id;
        Str sha256;
        Vec(Str) tags;
        Str created_at;
        u64 model_id;
        Str  json    = StrInit(&alloc);
    
        Vec(FunctionInfo) functions = VecInitWithDeepCopy(NULL, FunctionInfoDeinit, &alloc);
    
        FunctionInfo func1 = {12345, StrInitFromZstr("test_func", &alloc), 1024, 4096};
        Str  json    = StrInit(&alloc);
    
        Vec(AnnSymbol) symbols = VecInitWithDeepCopy(NULL, AnnSymbolDeinit, &alloc);
    
        AnnSymbol sym1             = {0};
        Str  json    = StrInit(&alloc);
    
        Vec(u32) numbers = VecInit(&alloc);
        u32 num1 = 1, num2 = 2, num3 = 3;
        VecPushBack(&numbers, num1);
        VecPushBack(&numbers, num3);
    
        Vec(Str) strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
    
        // Create strings and push them properly
        VecPushBack(&strings, str3);
    
        Vec(bool) booleans = VecInit(&alloc);
        bool bool1 = true, bool2 = false, bool3 = true;
        VecPushBack(&booleans, bool1);
    } AnnSymbol;
    
    typedef Vec(AnnSymbol) AnnSymbols;
    
    typedef struct ApiResponse {
    } FunctionInfo;
    
    typedef Vec(FunctionInfo) FunctionInfos;
    
    typedef struct ModelInfo {
    } ModelInfo;
    
    typedef Vec(ModelInfo) ModelInfos;
    
    typedef struct SearchResult {
        u64 analysis_id;
        Str sha256;
        Vec(Str) tags;
        Str created_at;
        u64 model_id;
    } SearchResult;
    
    typedef Vec(SearchResult) SearchResults;
    
    void FunctionInfoDeinit(FunctionInfo *info) {
        StrIter si = StrIterFromStr(json);
    
        typedef Vec(AnnSymbol) Symbols;
        Symbols symbols = VecInitWithDeepCopy(NULL, AnnSymbolDeinit, &alloc);
        Str name;
        f64 price;
        Vec(Str) tags;
    } SimpleProduct;
        Str  json    = StrInit(&alloc);
    
        Vec(Str) languages = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
    
        // Create strings and push them properly
        f64  small_float;
        bool is_valid;
        Vec(Str) empty_array;
        Vec(i64) numbers;
    } EdgeCaseData;
        bool is_valid;
        Vec(Str) empty_array;
        Vec(i64) numbers;
    } EdgeCaseData;
        StrIter si1   = StrIterFromStr(json1);
    
        Vec(i32) items = VecInit(&alloc);
    
        JR_OBJ(si1, {
        StrIter si2   = StrIterFromStr(json2);
    
        Vec(Str) data = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
    
        JR_OBJ(si2, {
        struct {
            i32 x_value;
            Vec(i32) filled_items;
        } obj = {0, VecInit(&alloc)};
        u32  timeout;
        Str  log_level;
        Vec(Str) features;
    } TestConfig;
        TestPerson user;
        TestConfig config;
        Vec(i32) numbers;
        Vec(bool) flags;
    } ComplexData;
        TestConfig config;
        Vec(i32) numbers;
        Vec(bool) flags;
    } ComplexData;
    
        // Original data
        Vec(i32) original_numbers = VecInit(&alloc);
        Vec(Str) original_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
        // Original data
        Vec(i32) original_numbers = VecInit(&alloc);
        Vec(Str) original_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
    
        // Populate arrays
    
        // Read back from JSON
        Vec(i32) parsed_numbers = VecInit(&alloc);
        Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
        // Read back from JSON
        Vec(i32) parsed_numbers = VecInit(&alloc);
        Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
    
        StrIter si = StrIterFromStr(json);
    
        // Original empty data
        Vec(i32) empty_numbers = VecInit(&alloc);
        Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
        Str empty_str          = StrInit(&alloc);
        // Original empty data
        Vec(i32) empty_numbers = VecInit(&alloc);
        Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
        Str empty_str          = StrInit(&alloc);
    
        // Read back from JSON
        Vec(i32) parsed_numbers = VecInit(&alloc);
        Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
        Str  parsed_str         = StrInit(&alloc);
        // Read back from JSON
        Vec(i32) parsed_numbers = VecInit(&alloc);
        Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit, &alloc);
        Str  parsed_str         = StrInit(&alloc);
        bool found_empty_object = false;
Last updated on