Modern C++ for C Programmers: Part 6 - Bert Hubert's writings
a day ago
- Static assert allows compile-time checks and self-documenting code.
- constexpr enables compile-time computation, improving performance and reducing runtime overhead.
- std::numeric_limits provides uniform access to type limits, replacing macros like ULLONG_MAX.
- iostreams are suitable for simple text I/O but not for high-performance tasks.
- C++ chrono library offers precise time measurement with system_clock, steady_clock, etc.
- Scoped enums (enum class) provide type safety and prevent name pollution.
- Initializer lists simplify initialization and iteration with braced-init-lists.
- C++ supports regular expressions and raw strings for flexible text processing.
- Default parameters and function overloading offer flexible function interfaces.
- std::optional provides a safe way to handle optional values without pointers or magic values.
- The article concludes with a summary and recommended books for learning modern C++.