Arrays are fixed-size sequence containers: they hold a specific number of elements ordered in a strict linear sequence.
They cannot be expanded or contracted dynamically
Another unique feature of array containers is that they can be treated as tuple objects
They cannot be expanded or contracted dynamically
Another unique feature of array containers is that they can be treated as tuple objects
Container properties
- Example:
- #include
- #include
- int main ()
- {
- std::array
myarray = { 2, 16, 77, 34, 50 }; - std::cout << "myarray contains:";
- for ( auto it = myarray.begin(); it != myarray.end(); ++it )
- std::cout << ' ' << *it;
- std::cout << '\n';
- return 0;
- }
- Sequence
Contiguous storage (allowing constant time random access to elements)
Fixed-size aggregate
Comments
Post a Comment