| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This is my from‑scratch to good-enough (you will tell me if it is actually good enough, not sure it worked for me) C++ path, built while following the excellent free tutorial at LearnCpp.com.
The repo mirrors LearnCpp’s, but adds a clean, runnable code path:
Tip: Treat this repo as your playground. Read, run, tweak, refactor, test.
xcode-select --install # Apple Command Line Tools (includes Apple Clang)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install llvm cmake ninja # Clang/LLVM, CMake, NinjaHomebrew’s clang++ typically lives at /opt/homebrew/opt/llvm/bin/clang++. Prefer that compiler path for the latest LLVM runtime and <format> support.
(Optional) prefer Homebrew LLVM in your shell:
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc
echo 'export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"' >> ~/.zshrc
echo 'export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"' >> ~/.zshrc
source ~/.zshrcSimply clone the source from this repository.
git clone https://github.com/samuruph/mylearncpp.git
cd mylearncppmkdir -p build && cd build
cmake -G Ninja .. # or: cmake ..
cmake --build .
ctest --output-on-failureRun a specific chapter example (see table below for targets), e.g.:
cmake --build build --target ch05_ptrs
./build/ch05_ptrs. ├─ CMakeLists.txt ├─ .clang-format / .clang-tidy / .gitignore ├─ C00-Getting-Started/ ├─ C01-Program-Structure/ ├─ C02-Functions/ ├─ C03-IO-Format/ ├─ C04-Types-Init/ ├─ C05-Pointers-References/ ├─ C06-Std-Containers-Algorithms/ ├─ C07-Classes-RAII/ ├─ C08-Smart-Pointers/ ├─ C09-Moves-Ownership/ ├─ C10-Templates-Concepts/ ├─ C11-Lambdas-Ranges/ ├─ C12-Error-Handling/ ├─ C13-Filesystem-Time/ ├─ C14-CMake-Project/ └─ C15-Testing/
Each chapter folder contains:
Read each chapter’s README first, then open sections/ to run examples.
| Chapter | Target(s) | TL;DR |
|---|---|---|
| C00 — Getting Started | ch00_hello | Install toolchain, build a hello world, debugger set default C++ language on vscode. LearnCpp’s intro explains the approach and who it’s for. |
| C01 — Program Structure | ch01_first | Statements, expressions, blocks, and main(). Write your first interactive program; chapter summary has a self‑quiz. |
| C02 — Functions | ch02_funcs | Why functions; decl/defn split; headers; pass small by value, big by const&, sinks by value/forwarding; chapter quiz available. |
| C03 — I/O & <format> | ch03_io | cin/cout/cerr basics; prefer C++20 <format> for type‑safe formatting (fallback to iostream manipulators if not available). |
| C04 — Types & Init | ch04_types | Fundamental types, sizes, conversions; prefer const/constexpr and brace‑init to avoid narrowing. |
| C05 — Pointers & References | ch05_ptrs | References alias; pointers store addresses; nullability; * and &; -> for member access; later, function pointers build on this. |
| C06 — Std Containers & Algos | ch06_stl | vector, maps, iterators; sort, find_if, projections. Chapter summaries on arrays/containers are good refreshers. |
| C07 — Classes & RAII | ch07_raii | Encapsulation; resource ownership via ctor/dtor; rule of five; move‑only wrappers; class invariants. |
| C08 — Smart Pointers | ch08_smart | Default to unique_ptr; use shared_ptr for true sharing; weak_ptr to break cycles. |
| C09 — Moves & Ownership | ch09_moves | Value semantics with cheap moves; NRVO; use std::move intentionally when transferring ownership. |
| C10 — Templates & Concepts | ch10_tpl | Function/class templates; constrain with C++20 concepts (std::integral, etc.). |
| C11 — Lambdas & Ranges | ch11_ranges | Captures ([=], [&], init‑capture); Ranges pipelines (filter/transform) for composable data transforms. |
| C12 — Error Handling | ch12_errors | std::optional for expected absence; throw/catch at module boundaries; avoid throwing from destructors. |
| C13 — Filesystem & Time | ch13_fs | Iterate directories with <filesystem>; measure with <chrono> using steady clocks. |
| C14 — CMake Project | ch14_cmake | Targets, per‑target warnings, and CTest; scale from single file to multi‑target projects. |
| C15 — Testing | ch15_tests | Minimal header‑only test runner + CTest; swap in Catch2/doctest later if desired. |
A quick set of “what you should retain” notes for anchor lessons and chapter summary pages. Use these alongside LearnCpp’s official pages:
LearnCpp also has an evolving Site Index that’s handy when you forget which lesson covered a specific symbol or topic.
This project is distributed under the terms of the MIT License. See LICENSE for more information.
| Back | FazBrowse Home | New Git URL |