Modern C++ for C Programmers: Part 3 - Bert Hubert's writings
a day ago
- Inheritance and polymorphism are useful but not mandatory; example with Event base class and derived classes using virtual functions.
- References are like pointers but save typing and enable operator overloading, e.g., v[12]=4.
- Templates provide zero-overhead generic programming, enabling containers like std::vector that are as efficient as hand-written code.
- Worked example: indexing 692MB of Linux kernel source code in 10 seconds using std::unordered_map, std::vector, iterators, and range-based for loops.
- C++ offers powerful standard containers (e.g., std::map, std::unordered_map, std::vector) without requiring full object-oriented design.