Learn how the STL array is like a vector but with a fixed size, and see how the array is optimized for speed and efficiency.
- [ Developer] The STL array type…is a fixed-size sequence container.…The size of the array is defined…when the array object is created.…The size cannot change during the life of the array.…The array object is available beginning with C++ 11.…The array is designed to be fast and efficient.…Although less functional than a vector,…it carries no data other than its elements,…and those elements are guaranteed to be stored…in contiguous memory locations.…Here I have a working copy of array.cpp…from Chapter Two of the exercise files.…
The array is defined in the array header.…A STL array is essentially a wrapper around a C array.…So it's very fast, very efficient,…and somewhat limited in what it an do.…You'll see here that it's constructed…very much like a vector.…You can use an initializer list.…You can use the default constructor and then add data later.…The size function returns the size,…which is always the size that…the array was constructed with.…
If I build and run here, you'll see…that our arrays have been constructed.…
- Template fundamentals
- STL containers
- Accessing iterators
- Output, forward, and bidirectional iterators
- The transform function
- Transforming strings and types
- Arithmetic, relational, and logical functions
- STL algorithms
Skill Level Intermediate
2. STL Containers
3. STL Iterators
5. STL Functions
6. STL Algorithm
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.