正常
Type Safety
Enums, unions, and raw pointers from the C era left behind far too many type-safety hazards — implicit conversions, undefined behavior, null pointer dereferences... Modern C++ ships a whole toolbox for plugging these holes. In this chapter we look at how enum class ends the nightmare of implicit enum conversions, how strong typedefs prevent parameter mix-ups, how variant safely replaces union, how optional elegantly expresses "a value may be absent", and how any delivers type erasure when you need it.