正常
Modern Approaches to Error Handling
Error handling is a core problem every C++ programmer has to face — C-style error codes can be ignored, exceptions are restricted in embedded environments, and bare pointers have unclear semantics for representing "no value." Modern C++ provides type-safe alternatives such as optional, variant, and expected. In this chapter we review the evolution of error handling, master the scenarios where each approach fits, and close with a scenario-based selection guide.