Modern Fixed-Size std::array (C++11)

🟢 Beginner

📖 Definition

Provided in <array>, std::array<T, N> wraps C-style fixed arrays into an STL container supporting .size(), bounds-checked .at(), iterator traversal, and zero performance overhead.

💡 Code Example

#include <iostream>
#include <array>

int main() {
    std::array<int, 4> data = {10, 20, 30, 40};

    std::cout << "Size: " << data.size() << "\n";
    std::cout << "Element at index 2: " << data.at(2) << "\n";
    return 0;
}