Make impossible state unrepresentable
summary
Use the type system to eliminate impossible states: model per-Q indices as an optional index so the struct shrinks from 24 bytes -> 12 bytes, removes duplicate initialization and runtime assertions, and guarantees you never read uninitialized indices. For GPU work, bundle a secondary command buffer with pipeline and a vector of commands to avoid costly pipeline rebinds and allow parallel command construction. For resource handles, prefer forbidding moves or delete move operations so handles never enter a useless "moved-from" state.
AI-written summary · about
chapters (5)
related talks
59mBuilding Cpp Interfaces That Are Hard to Use Incorrectly
55mBreaking Dependencies: Type Erasure - The Implementation Details
26mWhen Idioms Become Bottlenecks
56m“High Performance Code 201: Hybrid Data Structures"
36mFunctional State Machines in Rust: Typestate and Newtype Patterns
55m“Using Types Effectively"
01h 33mSafe and Sane C++ Types
51mTechniques for Wielding Data and Behaviors
