Overview
C++ is a general-purpose programming language created as an extension of C. It has imperative, object-oriented, and generic programming features while also providing facilities for low-level memory manipulation. Modern C++ (C++17/20/23) has evolved significantly, offering smart pointers, lambda expressions, concepts, ranges, and modules that make it both safer and more expressive while maintaining its performance edge.
Key Features
- Zero-overhead abstractions — Templates and inlining eliminate runtime cost of abstractions
- RAII — Resource Acquisition Is Initialization for deterministic resource management
- Templates & generics — Compile-time polymorphism and metaprogramming
- Standard Template Library (STL) — Rich containers, algorithms, and iterators
- Multi-paradigm — Supports OOP, procedural, functional, and generic styles
Code Example
cpp
Learning Resources
Learning Path
23 topics across 5 sections
1Basics
C++ fundamentals building on C knowledge.
- Introduction to C++ — C vs C++, compilers, and the C++ standards timeline
- Variables & Types — auto, decltype, references (&), const, and constexpr
- Namespaces — namespace, using declarations, and avoiding name collisions
- I/O Streams — cin, cout, cerr, stringstream, and formatting
- Control Flow — Range-based for, structured bindings, and if-with-initializer
2OOP in C++
Classes, inheritance, and polymorphism.
- Classes — Constructors, destructors, member functions, access specifiers
- Inheritance — Single, multiple, virtual inheritance, and diamond problem
- Polymorphism — Virtual functions, vtable, pure virtual, override, final
- Operator Overloading — Overloading arithmetic, comparison, I/O, and subscript operators
- RAII — Resource Acquisition Is Initialization — deterministic cleanup
3Templates & Generic Programming
Compile-time polymorphism and metaprogramming.
- Function Templates — Template parameters, type deduction, and specialization
- Class Templates — Generic containers, non-type parameters, and variadic templates
- Concepts (C++20) — Constraining templates with semantic requirements
- SFINAE & constexpr if — Compile-time branching and template metaprogramming
4STL
The Standard Template Library — containers, algorithms, iterators.
- Containers — vector, map, unordered_map, set, deque, array
- Algorithms — sort, find, transform, accumulate, and ranges (C++20)
- Iterators — Iterator categories, begin/end, and reverse iterators
- Smart Pointers — unique_ptr, shared_ptr, weak_ptr, and make_unique/shared
5Modern C++ (17/20/23)
Latest features for safer, more expressive code.
- std::optional & std::variant — Sum types and nullable values without pointers
- Structured Bindings — auto [x, y] = pair; — decomposing composite types
- Ranges & Views — Lazy, composable range adaptors (C++20)
- Coroutines — co_await, co_yield, co_return (C++20)
- Modules — import/export replacing header files (C++20)