C++ std::array Changing all array elements at once


Example

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);
    
}