From Jason Turner
Watch on YouTube

Summary

This episode explores why std::vector behaves differently from other vector specializations in C++. Jason explains that vector uses a space-optimized representation that packs boolean values as individual bits rather than full bytes, resulting in significant space savings. However, this optimization comes with unexpected behaviors, particularly when trying to get references to individual elements, as C++ has no way to reference individual bits directly.

Resources

Tags