Changing all array elements at once

suggest change

The member function fill() can be used on std::array for changing the values at once post initialization

int main() {
    
    std::array<int, 3> arr = { 1, 2, 3 };
    // change all elements of the array to 100
    arr.fill(100);
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents