EXPLORATION 62

image

Old-Fashioned Arrays

Throughout this book, I’ve used std::vector for arrays. Exploration 53 touched on std::array and introduced other containers, such as std::deque. Hidden in the implementation of these types is an old-fashioned, crude, and unsafe style of array. This Exploration takes a look at this relic from C, not because I want you ever to use it, but because you may have to read code that uses this language construct, and it will help you to understand how the standard library can implement vector, array, and similar types. You may be surprised to learn that C-style arrays have much in common with pointers.

C-Style Arrays ...

Get Exploring C++ 11, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.