From Jason Turner
Watch on YouTube

Summary

Jason explores the internal implementation of std::array by creating a simplified version from scratch. He reveals that std::array is essentially a struct with a public C-style array member (with names like _M_elems in standard library implementations), but explains why users can't directly access this member due to identifier naming rules that reserve certain patterns for standard library implementers. Through his implementation, he demonstrates how std::array provides type safety over raw C arrays while supporting features like range-based for loops and structured bindings through appropriate interface functions.

Resources

Tags