VecDeleteFast

Table of Contents

VecDeleteFast

Description

Delete item at given index using faster implementation. Order preservation is not guaranteed

Success

return

Failure

Does not return

Usage example (Cross-references)

    // Test VecDeleteFast (fast delete)
    // This replaces the deleted element with the last element
    VecDeleteFast(&vec, 2); // Delete 30
    
    // Check vector length after fast deletion
    // Test VecDeleteFast function
    bool test_vec_delete_fast(void) {
    printf("Testing VecDeleteFast\n");
    
    // Create a vector of integers
    
    // Delete element at index 1 (value 20) using fast delete
    VecDeleteFast(&vec, 1);
    
    // Check new length
    int valueToBeDeleted = VecAt(&vec, fast_index);
    int lastValue        = VecAt(&vec, vec.length - 1); // Should move to deleted position
    VecDeleteFast(&vec, fast_index);
    
    // Print after state
    
    // Test R-value fast delete operation
    VecDeleteFast(&vec, 2);
    
    // Print after state

Share :