ROADMAP C++
1. FOUNDATIONS - CƠ BẢN
1.1 Cài đặt và Setup
- Cài đặt compiler (GCC, Clang, MSVC)
- IDE/Editor (Visual Studio, CLion, VS Code, Qt Creator)
- Build systems (CMake, Make, Ninja)
- Compilation process
- Hello World với cout
1.2 C++ cơ bản (nếu chưa biết C)
- Variables và data types
- Operators
- Control flow (if, switch, loops)
- Functions
- Arrays
- Pointers và references
- Basic I/O (cin, cout)
1.3 C++ vs C - Điểm khác biệt
- cout/cin thay printf/scanf
- References
- Function overloading
- Default parameters
- Namespace
- bool type
- new/delete thay malloc/free
- Inline functions
- const correctness
2. OBJECT-ORIENTED PROGRAMMING (OOP)
2.1 Classes và Objects
- Class definition
- Member variables (attributes)
- Member functions (methods)
- Access specifiers (private, public, protected)
- Constructors
- Destructor
- this pointer
- const member functions
- Static members
- Friend functions và friend classes
2.2 Constructors Deep Dive
- Default constructor
- Parameterized constructor
- Copy constructor
- Move constructor (C++11)
- Constructor delegation
- Explicit constructors
- Constructor initialization lists
- Uniform initialization (C++11)
2.3 Encapsulation
- Data hiding
- Getters và setters
- Private implementation
- PIMPL idiom (Pointer to Implementation)
2.4 Inheritance
- Single inheritance
- Multiple inheritance
- Protected access specifier
- Constructor/destructor calling order
- Diamond problem
- Virtual inheritance
- Upcasting và downcasting
- Object slicing
2.5 Polymorphism
- Function overloading (compile-time)
- Operator overloading
- Virtual functions (runtime polymorphism)
- Pure virtual functions
- Abstract classes
- Virtual destructors
- Virtual function tables (vtable)
- Override keyword (C++11)
- Final keyword (C++11)
- Dynamic binding
2.6 Abstraction
- Interfaces (pure virtual classes)
- Abstract base classes
- Design by contract
3. OPERATOR OVERLOADING
3.1 Overloadable Operators
- Arithmetic operators (+, -, *, /, %)
- Comparison operators (==, !=, <, >, <=, >=)
- Logical operators (&&, ||, !)
- Bitwise operators
- Assignment operator (=)
- Compound assignment (+=, -=, etc.)
- Increment/decrement (++, –)
- Subscript operator ([])
- Function call operator ()
- Arrow operator (->)
- Stream operators («, »)
3.2 Rules và Best Practices
- Member vs non-member operators
- Return types
- Const correctness
- Symmetry trong operators
- Rule of Three/Five/Zero
4. MEMORY MANAGEMENT
4.1 Dynamic Memory
- new và delete
- new[] và delete[]
- Memory leaks
- Dangling pointers
- Placement new
- nothrow new
4.2 RAII (Resource Acquisition Is Initialization)
- RAII principle
- Smart pointers preview
- Automatic cleanup
- Exception safety
4.3 Copy Control
- Copy constructor
- Copy assignment operator
- Move constructor (C++11)
- Move assignment (C++11)
- Rule of Three
- Rule of Five
- Rule of Zero
5. TEMPLATES
5.1 Function Templates
- Template syntax
- Template parameters
- Template instantiation
- Template specialization
- Function template overloading
- Type deduction
5.2 Class Templates
- Template class definition
- Member function templates
- Template specialization (full)
- Partial specialization
- Default template arguments
- Template template parameters
5.3 Advanced Templates
- Variadic templates (C++11)
- Template metaprogramming
- SFINAE (Substitution Failure Is Not An Error)
- Template constraints (C++20 concepts)
- Type traits
- Compile-time computation
6. STANDARD TEMPLATE LIBRARY (STL)
6.1 Containers
- Sequence containers:
- vector
- deque
- list
- forward_list (C++11)
- array (C++11)
- Associative containers:
- set, multiset
- map, multimap
- Unordered containers (C++11):
- unordered_set, unordered_multiset
- unordered_map, unordered_multimap
- Container adapters:
- stack
- queue
- priority_queue
6.2 Iterators
- Iterator categories (input, output, forward, bidirectional, random access)
- begin(), end()
- Iterator operations
- Iterator invalidation
- Reverse iterators
- const iterators
6.3 Algorithms
- Non-modifying:
- find, find_if, count, count_if
- all_of, any_of, none_of
- for_each
- Modifying:
- copy, move, swap
- fill, generate
- transform
- replace, remove
- Sorting:
- sort, stable_sort
- partial_sort
- nth_element
- Binary search:
- binary_search
- lower_bound, upper_bound
- Set operations:
- set_union, set_intersection
- merge
- Heap operations:
- make_heap, push_heap, pop_heap
- Min/Max:
- min, max, minmax
- min_element, max_element
6.4 Function Objects (Functors)
- Function objects
- Predicate functions
- Lambda expressions (C++11)
- std::function (C++11)
- std::bind (C++11)
- Callable objects
6.5 Utilities
- pair
- tuple (C++11)
- optional (C++17)
- variant (C++17)
- any (C++17)
- string_view (C++17)
7. SMART POINTERS (C++11)
7.1 Types
- unique_ptr
- shared_ptr
- weak_ptr
- auto_ptr (deprecated)
7.2 Usage
- make_unique (C++14)
- make_shared
- Custom deleters
- Ownership semantics
- Circular reference problems
- Performance considerations
8. EXCEPTION HANDLING
8.1 Basics
- try-catch blocks
- throw statement
- Exception types
- Standard exceptions
- catch-all handler
- Rethrowing exceptions
8.2 Advanced
- Exception specifications (deprecated)
- noexcept (C++11)
- Exception safety guarantees
- Stack unwinding
- RAII và exceptions
- Custom exception classes
- Exception handling best practices
9. STREAMS AND I/O
9.1 Stream Classes
- iostream hierarchy
- istream, ostream
- ifstream, ofstream, fstream
- istringstream, ostringstream, stringstream
9.2 Stream Operations
- Formatted I/O
- Stream manipulators (setw, setprecision, etc.)
- Stream states
- File operations
- Binary I/O
- Stream buffers
- Custom stream manipulators
9.3 File I/O
- Opening/closing files
- Reading/writing text
- Reading/writing binary
- File positioning
- Error handling
10. MOVE SEMANTICS & RVALUE REFERENCES (C++11)
10.1 Rvalue References
- Lvalues vs rvalues
- Rvalue reference syntax (&&)
- std::move
- Perfect forwarding
- Universal references
- Reference collapsing
10.2 Move Semantics
- Move constructor
- Move assignment operator
- Move-only types
- Return value optimization (RVO)
- Named return value optimization (NRVO)
11. MODERN C++ FEATURES
11.1 C++11 Features
- auto keyword
- decltype
- Range-based for loops
- nullptr
- constexpr
- static_assert
- Delegating constructors
- Inheriting constructors
- Default và deleted functions
- Enum classes (strongly typed enums)
- Raw string literals
- User-defined literals
- Attributes
- Initializer lists
11.2 C++14 Features
- Generic lambdas
- Return type deduction
- Variable templates
- Binary literals
- Digit separators
- std::make_unique
- Relaxed constexpr
11.3 C++17 Features
- Structured bindings
- if/switch with initializer
- constexpr if
- Fold expressions
- std::optional
- std::variant
- std::any
- std::string_view
- Filesystem library
- Parallel algorithms
- Class template argument deduction (CTAD)
11.4 C++20 Features
- Concepts
- Ranges
- Coroutines
- Modules
- Three-way comparison operator (<=>)
- consteval, constinit
- std::span
- Calendar và timezone
- std::format
- Designated initializers
11.5 C++23 Features
- Deducing this
- if consteval
- Multidimensional subscript operator
- std::expected
- std::mdspan
- Stack trace library
12. LAMBDA EXPRESSIONS
12.1 Lambda Basics
- Lambda syntax
- Capture lists (by value, by reference)
- Parameters
- Return type
- Mutable lambdas
12.2 Advanced Lambdas
- Generic lambdas (C++14)
- Init capture (C++14)
- constexpr lambdas (C++17)
- Template lambdas (C++20)
- Lambda capture của this
- Stateless lambdas
13. CONCURRENCY & MULTITHREADING (C++11)
13.1 Threads
- std::thread
- Thread creation
- Joining và detaching
- Thread arguments
- Thread IDs
- Hardware concurrency
13.2 Synchronization
- std::mutex
- std::recursive_mutex
- std::timed_mutex
- std::lock_guard
- std::unique_lock
- std::scoped_lock (C++17)
- Deadlock prevention
- std::call_once
13.3 Condition Variables
- std::condition_variable
- Wait và notify
- Spurious wakeups
- Producer-consumer pattern
13.4 Atomic Operations
- std::atomic
- Memory ordering
- Lock-free programming
- Compare-and-swap
- Atomic flags
13.5 Async Programming
- std::async
- std::future
- std::promise
- std::packaged_task
- std::shared_future
13.6 Thread-Safe Containers
- Concurrent queue patterns
- Lock-free data structures
- Thread pools
14. TYPE TRAITS & METAPROGRAMMING
14.1 Type Traits
- Type categories
- Type properties
- Type transformations
- Type relationships
- SFINAE với enable_if
- Constexpr if (C++17)
14.2 Template Metaprogramming
- Compile-time computation
- Recursive templates
- Tag dispatching
- Policy-based design
- Expression templates
14.3 Concepts (C++20)
- Defining concepts
- Requires expressions
- Requires clauses
- Standard concepts
- Concept composition
15. DESIGN PATTERNS
15.1 Creational Patterns
- Singleton
- Factory Method
- Abstract Factory
- Builder
- Prototype
- Object Pool
15.2 Structural Patterns
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Flyweight
- Proxy
- PIMPL
15.3 Behavioral Patterns
- Chain of Responsibility
- Command
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Template Method
- Visitor
15.4 Modern C++ Idioms
- RAII
- Copy-and-swap
- Curiously Recurring Template Pattern (CRTP)
- Barton-Nackman trick
- Expression templates
- Type erasure
- Tag dispatching
16. STANDARD LIBRARY DEEP DIVE
16.1 String Processing
- std::string
- String operations
- String streams
- Regular expressions (std::regex)
- String algorithms
16.2 Numerics
16.3 Time & Date
- std::chrono (C++11)
- Duration
- Time points
- Clocks
- Calendar (C++20)
16.4 Filesystem (C++17)
- Path operations
- Directory iteration
- File status
- File operations
- Permissions
17. ADVANCED TOPICS
17.1 Custom Memory Management
- Overloading new/delete
- Placement new
- Custom allocators
- Memory pools
- STL allocators
- Polymorphic allocators (C++17)
17.2 Name Lookup
- Argument-dependent lookup (ADL)
- Qualified name lookup
- Unqualified name lookup
- Two-phase lookup
17.3 Type System
- Type conversions
- static_cast
- dynamic_cast
- const_cast
- reinterpret_cast
- RTTI (typeid, type_info)
17.4 Undefined Behavior
- Common UB scenarios
- How to avoid UB
- Sanitizers (AddressSanitizer, UBSan)
18. PERFORMANCE & OPTIMIZATION
18.1 Optimization Techniques
- Inlining
- Return value optimization
- Move semantics
- constexpr computations
- Template specialization
- Cache-friendly code
- Branch prediction
- Loop optimization
18.2 Profiling
- Profiling tools (gprof, Valgrind, perf)
- Benchmarking (Google Benchmark)
- Memory profiling
- CPU profiling
- Cache profiling
18.3 Performance Best Practices
- Pass by reference
- Reserve capacity
- Avoid unnecessary copies
- Use appropriate containers
- Algorithm selection
- Compile-time computation
19. TESTING & DEBUGGING
19.1 Testing Frameworks
- Google Test
- Catch2
- Boost.Test
- doctest
- Unit testing
- Integration testing
- Mocking (Google Mock)
19.2 Debugging
- GDB
- LLDB
- Visual Studio Debugger
- Debugging techniques
- Watchpoints
- Conditional breakpoints
- Core dumps
19.3 Static Analysis
- Clang-Tidy
- Cppcheck
- PVS-Studio
- Static analyzers
19.4 Code Coverage
- gcov/lcov
- Coverage tools
- Coverage-driven testing
20. BUILD SYSTEMS & TOOLS
20.1 CMake
- CMakeLists.txt
- Targets
- Dependencies
- Generator expressions
- Find modules
- Config files
- Modern CMake practices
20.2 Package Managers
- Conan
- vcpkg
- Hunter
20.3 Development Tools
- Compiler explorers (Godbolt)
- Code formatters (clang-format)
- Linters
- Documentation (Doxygen)
- Version control (Git)
21. LIBRARIES & FRAMEWORKS
21.1 Boost
- Boost overview
- Smart pointers (legacy)
- String algorithms
- Filesystem (legacy)
- Asio (networking)
- Spirit (parsing)
- Graph
- Multi-threading utilities
21.2 GUI Frameworks
- Qt
- wxWidgets
- GTK+
- Dear ImGui
21.3 Networking
- Boost.Asio
- POCO
- Socket programming
- HTTP libraries
21.4 Database
- SQLite
- MySQL/MariaDB connectors
- PostgreSQL
- ORM libraries
21.5 Graphics
- OpenGL
- Vulkan
- DirectX
- SDL
- SFML
21.6 Game Development
- Unreal Engine
- Unity (via bindings)
- Custom engines
21.7 Scientific Computing
- Eigen (linear algebra)
- Armadillo
- Intel MKL
- BLAS/LAPACK
22. SPECIALIZED DOMAINS
22.1 Systems Programming
- OS interaction
- Process management
- System calls
- Low-level programming
22.2 Embedded C++
- Embedded constraints
- Real-time systems
- Hardware interfaces
- Bare metal programming
22.3 High-Performance Computing
- Parallel algorithms
- OpenMP
- MPI
- CUDA (GPU programming)
22.4 Financial Computing
- Low-latency systems
- Numerical precision
- Financial libraries
22.5 Game Development
- Game loops
- Entity-Component Systems
- Physics engines
- Rendering pipelines
23. BEST PRACTICES & GUIDELINES
23.1 Coding Standards
- C++ Core Guidelines
- Google C++ Style Guide
- MISRA C++
- AUTOSAR C++
- Company-specific standards
23.2 Modern C++ Best Practices
- Prefer RAII
- Use smart pointers
- Prefer algorithms to loops
- Use const correctness
- Avoid raw pointers
- Prefer standard library
- Use auto judiciously
- Value semantics
23.3 Code Quality
- SOLID principles
- DRY (Don’t Repeat Yourself)
- KISS (Keep It Simple, Stupid)
- YAGNI (You Aren’t Gonna Need It)
- Code reviews
- Refactoring
24. INTEROPERABILITY
24.1 C Interop
- extern “C”
- Using C libraries
- Name mangling
- ABI compatibility
24.2 Other Languages
- Python bindings (pybind11, Boost.Python)
- C# interop
- Java JNI
- JavaScript (Emscripten, WebAssembly)
24.3 Platform-Specific
- Windows API
- POSIX
- Platform abstraction layers
25. REAL-WORLD PROJECTS
25.1 Project Ideas
- CLI applications
- Web server
- Database engine
- Game engine
- Compiler/Interpreter
- Text editor
- Image processor
- Network chat application
- HTTP client/server
- File compression tool
- Memory allocator
- Container library
- JSON parser
- HTTP parser
- Thread pool
- Logger library
25.2 Open Source
- Contributing to projects
- Reading large codebases
- Popular C++ projects (LLVM, Chromium, Qt, etc.)
LỘ TRÌNH HỌC ĐỀ XUẤT
Tháng 1-2: Foundations, C++ basics, OOP fundamentals Tháng 3: Advanced OOP, Operator overloading, Memory management Tháng 4: Templates, STL containers và algorithms Tháng 5: Smart pointers, Exception handling, I/O Tháng 6: Move semantics, Modern C++ (C++11/14) Tháng 7: Lambda expressions, Multithreading basics Tháng 8: Advanced concurrency, Type traits Tháng 9: C++17/20/23 features, Design patterns Tháng 10: Performance optimization, Testing Tháng 11: Build systems, Libraries exploration Tháng 12: Specialized domains, Real projects Ongoing: Advanced topics, Best practices, Open source
TÀI LIỆU HỌC
Sách cơ bản:
- C++ Primer (Lippman)
- Programming: Principles and Practice Using C++ (Stroustrup)
- A Tour of C++ (Stroustrup)
Sách nâng cao:
- Effective C++ (Meyers)
- More Effective C++ (Meyers)
- Effective Modern C++ (Meyers)
- Effective STL (Meyers)
- C++ Concurrency in Action (Williams)
- The C++ Programming Language (Stroustrup)
Design & Architecture:
- Design Patterns (Gang of Four)
- Modern C++ Design (Alexandrescu)
- C++ Templates: The Complete Guide
- Large-Scale C++ Software Design
Best Practices:
- C++ Core Guidelines
- Exceptional C++ (Sutter)
- C++ Coding Standards (Sutter & Alexandrescu)
Online Resources:
- cppreference.com
- isocpp.org
- CppCon talks
- Compiler Explorer (godbolt.org)