Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ Step by Step

Modern C++23 Learning Project - From First Principles to Mastery

A comprehensive C++ learning project combining in-depth documentation with practical, hands-on lessons. Master modern C++ through understanding first principles, memory management, zero-cost abstractions, and the STL.


🎯 Project Philosophy

Learn from first principles - understand the machine, then build abstractions.

C++ is unique because it gives you:

  1. Direct Memory Control - Understand every byte
  2. Compile-Time Computation - Shift work to the compiler
  3. Zero-Cost Abstractions - Pay only for what you use

This project teaches you why C++ works the way it does, not just how to write syntax.


📁 Project Structure

cpp-step-by-step/
├── docs/                      # 📚 Comprehensive documentation
│   ├── 00_foundations/        # Theoretical foundations
│   ├── 01_learning_path/      # Learning roadmap & milestones
│   ├── 02_memory_mastery/     # Deep dive into memory management
│   ├── 03_zero_cost_abstractions/
│   ├── 04_stl_mastery/        # STL containers, algorithms, iterators
│   ├── 05_modern_cpp/         # C++11/14/17/20/23 features
│   ├── 06_best_practices/     # Code style, design patterns
│   ├── 07_toolchain/          # CMake, debugging, profiling
│   ├── 08_advanced_topics/    # Concurrency, networking, graphics
│   ├── 09_interviews/         # Interview prep & career guide
│   ├── cheatsheets/           # Quick reference guides
│   ├── exercises/             # Practice problems (25+)
│   ├── resources/             # Curated books & videos
│   └── projects/              # Project ideas & templates
│
├── src/                       # 💻 Practical lessons
│   ├── 01_memory_control/     # Stack, heap, pointers, RAII
│   ├── 02_zero_cost_abstraction/  # Classes, move semantics, templates
│   └── 03_toolbox/            # STL, modern features, build tools
│
├── tests/                     # ✅ Lesson verification
├── CMakeLists.txt             # Build configuration
└── README.md                  # This file

🚀 Quick Start

Prerequisites

  • Compiler: Clang 16+ (recommended) or GCC 13+ or MSVC 19.37+
  • Build Tool: CMake 3.25+ and Ninja
  • Platform: Windows, macOS, or Linux

Build & Run

# Clone the repository
git clone https://github.com/Clearzero22/cpp-step-by-step
cd cpp-step-by-step

# Configure and build
cmake -G Ninja -B build
cmake --build build

# Run a specific lesson
./build/bin/lesson01_stack_heap          # Windows: .\build\bin\lesson01_stack_heap.exe
./build/bin/lesson02_pointers_references
./build/bin/lesson03_object_lifetime
./build/bin/lesson04_raii

Windows Quick Commands:

build.bat    # Configure & build
run.bat      # Run all lessons

📖 Learning Path

Phase 1: Foundations (1-2 weeks)

Start with the theory, then write code:

  1. Read: docs/00_foundations/01_first_principles.md

    • What makes C++ unique
    • The three pillars explained
  2. Read: docs/00_foundations/02_roadmap.md

    • Complete learning roadmap
    • Skill milestones
  3. Code: Complete src/01_memory_control/ lessons

    ./build/bin/lesson01_stack_heap
    ./build/bin/lesson02_pointers_references
    ./build/bin/lesson03_object_lifetime
    ./build/bin/lesson04_raii

Phase 2: Memory Mastery (3-4 weeks)

  1. Study: docs/02_memory_mastery/

    • Deep dive into stack vs heap
    • Pointers and references internals
    • Object lifetime and RAII
    • Memory safety patterns
  2. Practice: exercises/02_intermediate/

    • 10+ memory-focused exercises
  3. Build: Complete a project from projects/01_cli_apps/

Phase 3: Zero-Cost Abstraction (4-6 weeks)

  1. Study: docs/03_zero_cost_abstractions/
  2. Code: src/02_zero_cost_abstraction/ lessons
  3. Master: Classes, move semantics, smart pointers, templates

Phase 4: The Toolbox (4-6 weeks)

  1. Study: docs/04_stl_mastery/ and docs/05_modern_cpp/
  2. Code: src/03_toolbox/ lessons
  3. Learn: CMake, debugging, profiling

📊 Progress Tracker

✅ Complete

Module Lessons Progress
Memory Control 16 100%
Documentation 50+ 100%
Cheatsheets 3 100%
Exercises 25+ 100%
Projects 16 100%

🚧 In Progress

Module Lessons Progress
Zero-Cost Abstraction 0 0%
Toolbox (STL) 0 0%
Modern Features 0 0%

🔗 Documentation to Code Mapping

Documentation Code Lessons Status
02_memory_mastery/ src/01_memory_control/ ✅ Complete
03_zero_cost_abstractions/ src/02_zero_cost_abstraction/ 📝 Planned
04_stl_mastery/ src/03_toolbox/01_stl/ 📝 Planned
05_modern_cpp/ src/03_toolbox/02_modern_features/ 📝 Planned
07_toolchain/ src/03_toolbox/03_compilation/ 📝 Planned

📚 Documentation Highlights

📖 Foundational Guides

  • First Principles - Understand C++'s core philosophy
  • Hardware Fundamentals - How C++ maps to machine code
  • Memory Model - Stack, heap, and everything in between

🎯 Learning Resources

  • Curated Books - Essential C++ reading list
  • Video Tutorials - YouTube channels and conference talks
  • Practice Projects - 16+ real-world project ideas

📝 Quick Reference

  • Syntax Cheatsheet - Variables, functions, classes, templates
  • STL Containers - Container selection and usage
  • Modern C++ - C++11 to C++23 features at a glance

💻 Exercises

  • Basics - Variables, control flow, functions
  • Intermediate - Memory, OOP, templates
  • Advanced - Concurrency, systems, performance

🛠️ Build System

This project uses CMake with Ninja for fast, parallel builds.

Configuration

# Debug build (default)
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Debug

# Release build (optimized)
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release

# Clang with sanitizers
cmake -G Ninja -B build -DCMAKE_CXX_COMPILER=clang++ -DENABLE_SANITIZERS=ON

Build Targets

# Build all lessons
cmake --build build

# Build specific target
cmake --build build --target lesson01_stack_heap

# Clean and rebuild
cmake --build build --clean-first

🧪 Testing

Each lesson includes assertions to verify understanding:

# Run all tests
ctest --test-dir build

# Run specific test
ctest --test-dir build -R lesson01

# Verbose output
ctest --test-dir build --verbose

🎓 Key Principles

First Principles Learning

"Don't memorize syntax - understand the machine."

  1. Theory → Practice → Mastery

    • Read the concept in docs/
    • Write the code in src/
    • Experiment and measure
  2. From Low-Level to High-Level

    • Start with memory layout
    • Add abstractions incrementally
    • Build complex systems confidently
  3. Always Question "Why?"

    • Why use this feature?
    • What's the runtime cost?
    • What's the alternative?
    • How does the compiler implement this?

📖 Recommended Reading Order

Absolute Beginners

  1. docs/00_foundations/01_first_principles.md
  2. docs/01_learning_path/01_roadmap.md
  3. src/01_memory_control/ (all lessons)

Intermediate Developers

  1. docs/02_memory_mastery/src/01_memory_control/
  2. docs/03_zero_cost_abstractions/src/02_zero_cost_abstraction/
  3. docs/06_best_practices/

Advanced Developers

  1. docs/08_advanced_topics/
  2. docs/09_interviews/
  3. Contribute to the project!

🤝 Contributing

This project is under active development. Contributions welcome!

  1. Fork the repository
  2. Create a feature branch
  3. Add lessons or documentation
  4. Submit a pull request

📊 Project Status

Component Status Progress
Documentation ✅ Complete 100%
Memory Control ✅ Complete 100%
Zero-Cost Abstraction 🚧 In Progress 0%
STL Mastery 📝 Planned 0%
Modern C++ 📝 Planned 0%
Toolchain 📝 Planned 0%

📜 License

MIT License - feel free to use this project for learning and teaching.


🔗 Resources

  • Documentation: docs/README.md
  • Learning Path: docs/01_learning_path/README.md
  • Exercises: docs/exercises/README.md
  • Projects: docs/projects/README.md

Status: 🚧 Under Active Development
Version: 1.0.0
C++ Standard: C++23
Last Updated: 2026-02-03


"C++ makes it harder to shoot yourself in the foot, but when you do, you blow off your whole leg."
— Bjarne Stroustrup (creator of C++)

About

Modern C++ (C++23) Step-by-Step Learning Guide Based on First Principles

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages