std::vector

cppreference.com

Example

main: () = {
    // Create a vector containing integers
    v: std::vector = (8, 4, 5, 9);
 
    // Add two more integers to vector
    v.push_back(6);
    v.push_back(9);
 
    // Overwrite element at position 2
    v[2] = -1;
 
    // Print out the vector
    for v do (n)
        std::cout << "(n)$ ";
    std::cout << '\n';
}

Output

8 4 -1 9 6 9 

Back to top

cpp2reference.com licensed under CC-BY-SA and GFDL.