<One-paragraph intro: this feature was introduced in C++NN to solve …, making …>
| Book | Video | Code | X |
|---|---|---|---|
| cppreference / markdown | Video Explanation | Practice Code |
Why was it introduced?
- <motivation 1>
- <motivation 2>
How does it differ from …?
- <contrast 1>
- <contrast 2>
<explanation + short code blocks; comment the wrong vs. correct form inline>
// example codeCorroborates how the feature is actually used in production-grade code. The snippet is taken from the in-repo MSVC STL reference basis
msvc-stl/(source filestl/inc/<header>);_NODISCARD/_CONSTEXPR17/_STDare internal library macros — ignore them when reading
<one line: why the standard library must use the feature here — un-writable / awkward by hand>
// MSVC STL · stl/inc/<header> (abridged)
// <verbatim excerpt of the real code; mark omissions with (abridged), never paraphrase from memory><tie it back to the toy example in section I: you write it this way → the standard library writes it this way too — one of the core motivations for introducing the feature>
- 0 - <exercise 0 topic>
- 1 - <exercise 1 topic>
Don't have d2x yet? Click to expand setup
# 1. Install xlings (Linux / macOS)
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash
# Windows PowerShell:
# irm https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.ps1 | iex
# 2. Install d2x and fetch this tutorial
xlings install d2x -y
d2x install d2mcpp
# 3. Enter the project directory & run the checker
cd d2mcppd2x checker <name>
Introduced in: C++NN Later improvements:
- C++14: <...>
- C++17: <...> (see the dedicated chapter)
- C++20: <...>
Teaching note: <cross-standard behavior differences / deprecation / why this exercise uses an exception standard>