Skip to content

Commit e0df4ef

Browse files
committed
book: add English support
1 parent 1e7f4ac commit e0df4ef

34 files changed

+1078
-16
lines changed

.github/workflows/online-ebook.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
push:
1010
branches: ["main"]
1111
paths:
12-
- 'book/src/**'
12+
- "book/src/**"
1313

1414
# Allows you to run this workflow manually from the Actions tab
1515
workflow_dispatch:
@@ -50,7 +50,7 @@ jobs:
5050
- name: Build with mdBook
5151
run: |
5252
export PATH=/home/xlings/.xlings_data/bin:$PATH
53-
mdbook build
53+
./build.sh
5454
- name: Upload artifact
5555
uses: actions/upload-pages-artifact@v3
5656
with:
@@ -66,4 +66,4 @@ jobs:
6666
steps:
6767
- name: Deploy to GitHub Pages
6868
id: deployment
69-
uses: actions/deploy-pages@v4
69+
uses: actions/deploy-pages@v4

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div align=center>
77
<img width="320" src="https://github.com/user-attachments/assets/dcc6bdea-71f8-4ed5-b445-6449c88655f3">
88

9-
<em>Dive to | Modern C++ Core Language Features - <b>"A C++ tutorial project focused on practical"</b></em>
9+
<em>D2X | Modern C++ Core Language Features - <b>"A C++ tutorial project focused on practical"</b></em>
1010

1111
<b> [Book] + [Video] + [Code] + [X] </b>
1212
</div>
@@ -95,4 +95,4 @@ d2x checker
9595
<img src="https://contrib.rocks/image?repo=Sunrisepeak/mcpp-standard" />
9696
</a>
9797

98-
<a href="https://hellogithub.com/repository/Sunrisepeak/mcpp-standard" target="_blank"><img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=7877f7cb12e940a5a432d49c19a360df&claim_uid=aNLTSv91Awj8ruX&theme=dark" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" /></a>
98+
<a href="https://hellogithub.com/repository/Sunrisepeak/mcpp-standard" target="_blank"><img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=7877f7cb12e940a5a432d49c19a360df&claim_uid=aNLTSv91Awj8ruX&theme=dark" alt="Featured|HelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" /></a>

book/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
**现代C++标准(cppref)**
22

3-
- C++11: [](https://zh.cppreference.com/w/cpp/11) / [En](https://en.cppreference.com/w/cpp/11)
3+
- C++11: [](https://zh.cppreference.com/w/cpp/11) / [En](https://en.cppreference.com/w/cpp/11)

book/build.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# srcirpt dir
4+
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
5+
6+
echo "[Top] - Building Chinese book..."
7+
cd "$SCRIPT_DIR"
8+
cd zh && mdbook build
9+
10+
echo "[Sub - 1] - Building English book..."
11+
cd "$SCRIPT_DIR"
12+
cd en && mdbook build
13+
14+
echo "Build completed."

book/en/book.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# docs: https://rust-lang.github.io/mdBook
2+
[book]
3+
title = "mcpp-standard | Dive into Modern C++ Core Language Features"
4+
author = "sunrispeak"
5+
language = "en"
6+
7+
[build]
8+
build-dir = "../book/en"
9+
10+
[output.html]
11+
git-repository-url = "https://github.com/Sunrisepeak/mcpp-standard"
12+
13+
[preprocessor.foo]
14+
# Add any additional configurations

book/en/imgs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../imgs

book/en/src/SUMMARY.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Summary
2+
3+
- [Language Support - 中文 | English](./lang.md)
4+
5+
# Getting Started
6+
7+
- [Preface](./base/chapter_0.md)
8+
- [Usage Guide](./base/chapter_1.md)
9+
10+
# C++11 Core Language Features
11+
12+
- [Type Deduction - auto and decltype](./cpp11/00-auto-and-decltype.md)
13+
- [Defaulted and Deleted Functions](./cpp11/01-default-and-delete.md)
14+
- [List Initialization](./cpp11/09-list-initialization.md)
15+
- [Delegating Constructors](./cpp11/10-delegating-constructors.md)
16+
- [Inherited Constructors](./cpp11/11-inherited-constructors.md)
17+
18+
# C++14 Core Language Features
19+
20+
# Additional Resources
21+
22+
- [Changelog](changelog.md)
23+
- [Frequently Asked Questions](fqa.md)

book/en/src/base/chapter_0.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Preface
2+
3+
mcpp-standard is an open-source tutorial project focused on **Modern C++ Core Language Features** with an emphasis on hands-on coding practice. The project structure follows the [Book + Video + Code + X] model, providing users with online e-books, corresponding instructional videos, accompanying practice code, as well as discussion forums and regular learning activities.
4+
5+
- [Book: Online E-book](https://sunrisepeak.github.io/mcpp-standard)
6+
- [Video: Instructional Videos](https://space.bilibili.com/65858958/lists/5208246?type=season)
7+
- [Code: Practice Code](https://github.com/Sunrisepeak/mcpp-standard/tree/main/dslings)
8+
- [X: mcpp Forum](https://forum.d2learn.org/category/20)
9+
10+
## Activities | [ 📣 MSCP - mcpp Project Learning and Contributor Cultivation Program ](https://moga.d2learn.org/activity/mscp/intro.html)
11+
12+
> MSCP is a "Earth Online" style role-playing game developed based on the mcpp-standard open-source project. In the game, you'll play as a "programming beginner" embarking on a challenging and exciting journey to learn Modern C++ and uncover its underlying truths...
13+
14+
- `Price:` Free
15+
- `Developer:` [Sunrisepeak](https://github.com/Sunrisepeak)
16+
- `Publisher:` [MOGA](https://moga.d2learn.org)
17+
- `Release Date:` October 2025
18+
- `Game Duration:` 100H - 200H
19+
- `Tags:` Souls-like, The Sims, 🌍Online, Programmer, C++, Open Source, Feynman Learning Method
20+
- [-> Game Details](https://moga.d2learn.org/activity/mscp/intro.html)

book/en/src/base/chapter_1.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Usage Guide
2+
3+
**mcpp-standard** is a hands-on tutorial project focused on Modern C++ core language features. Based on the [xlings(d2x) tool](https://github.com/Sunrisepeak/mcpp-standard), it implements a **compiler-driven development model** for code practice that can automatically detect exercise code status and navigate to the next exercise.
4+
5+
## 0. xlings Tool Installation
6+
7+
> xlings contains the tools required for the tutorial project - [More tool details](https://github.com/d2learn/xlings)
8+
9+
**Linux**
10+
11+
```bash
12+
curl -fsSL https://d2learn.org/xlings-install.sh | bash
13+
```
14+
15+
or
16+
17+
```bash
18+
wget https://d2learn.org/xlings-install.sh -O - | bash
19+
```
20+
21+
**Windows - PowerShell**
22+
23+
```bash
24+
Invoke-Expression (Invoke-Webrequest 'https://d2learn.org/xlings-install.ps1.txt' -UseBasicParsing).Content
25+
```
26+
27+
## 1. Get Project and Auto-configure Environment
28+
29+
> Download the project to current directory and automatically configure local environment
30+
31+
```bash
32+
xlings install d2x:mcpp-standard
33+
```
34+
35+
### Local E-book
36+
37+
> Execute `d2x book` command in the project directory to open local documentation (includes usage guide and e-book)
38+
39+
```bash
40+
d2x book
41+
```
42+
43+
### Practice Code Auto-detection
44+
45+
> Enter the project directory `mcpp-standard` and run the checker command to enter the practice code auto-detection program
46+
47+
```bash
48+
xlings checker
49+
```
50+
51+
### Specify Exercise for Detection
52+
53+
```bash
54+
xlings checker [name]
55+
```
56+
57+
> Note: Exercise names support fuzzy matching
58+
59+
### Sync Latest Practice Code
60+
61+
> Since the project is continuously updated, you can use the following command for automatic synchronization (if synchronization fails, you may need to manually update the project code using git)
62+
63+
```bash
64+
d2x update
65+
```
66+
67+
## 2. Automated Detection Program Introduction
68+
69+
After entering the automated code practice environment using `xlings checker`, the tool will automatically locate and open the corresponding practice code file, and output compiler errors and hints in the console. The detection program generally has two detection phases: the first is compile-time detection, where you need to fix compilation errors based on hints in the practice code and compiler error messages in the console; the second is runtime detection, which checks if the current code passes all checkpoints when running. When compilation errors are fixed and all checkpoints are passed, the console will display that the current exercise is completed and prompt you to proceed to the next exercise.
70+
71+
**Practice Code File Example**
72+
73+
```cpp
74+
// mcpp-standard: https://github.com/Sunrisepeak/mcpp-standard
75+
// license: Apache-2.0
76+
// file: dslings/hello-mcpp.cpp
77+
//
78+
// Exercise: Automated Code Practice Tutorial
79+
//
80+
// Tips:
81+
// This project uses the xlings tool to build automated code practice projects. Execute
82+
// xlings checker in the project root directory to enter "compiler-driven development mode"
83+
// for automatic exercise code detection.
84+
// You need to modify errors in the code based on console error messages and hints.
85+
// When all compilation errors and runtime checkpoints are fixed, you can delete or comment
86+
// out the D2X_WAIT macro in the code to automatically proceed to the next exercise.
87+
//
88+
// - D2X_WAIT: This macro isolates different exercises. You can delete or comment it out to proceed to the next exercise.
89+
// - d2x_assert_eq: This macro is used for runtime checkpoints. You need to fix code errors so that all
90+
// - D2X_YOUR_ANSWER: This macro indicates code that needs modification, typically used for code completion (replace this macro with correct code)
91+
//
92+
// Auto-Checker Command:
93+
//
94+
// d2x checker hello-mcpp
95+
//
96+
97+
#include <d2x/common.hpp>
98+
99+
// You can observe "real-time" changes in the console when modifying code
100+
101+
int main() {
102+
103+
std::cout << "hello, mcpp!" << std:endl; // 0. Fix this compilation error
104+
105+
int a = 1.1; // 1. Fix this runtime error, change int to double to pass the check
106+
107+
d2x_assert_eq(a, 1.1); // 2. Runtime checkpoint, need to fix code to pass all checkpoints (cannot directly delete checkpoint code)
108+
109+
D2X_YOUR_ANSWER b = a; // 3. Fix this compilation error, give b an appropriate type
110+
111+
d2x_assert_eq(b, 1); // 4. Runtime checkpoint 2
112+
113+
D2X_WAIT // 5. Delete or comment out this macro to proceed to the next exercise (project formal code practice)
114+
115+
return 0;
116+
}
117+
```
118+
119+
**Console Output and Explanation**
120+
121+
```bash
122+
🌏Progress: [>----------] 0/10 -->> Shows current exercise progress
123+
124+
[Target: 00-0-hello-mcpp] - normal -->> Current exercise name
125+
126+
❌ Error: Compilation/Running failed for dslings/hello-mcpp.cpp -->> Shows detection status
127+
128+
The code exist some error!
129+
130+
---------C-Output--------- - Compiler output information
131+
[HONLY LOGW]: main: dslings/hello-mcpp.cpp:24 - ❌ | a == 1.1 (1 == 1.100000) -->> Error hint and location (line 24)
132+
[HONLY LOGW]: main: dslings/hello-mcpp.cpp:26 - 🥳 Delete the D2X_WAIT to continue...
133+
134+
135+
AI-Tips-Config: https://d2learn.org/docs/xlings -->> AI hints (requires configuring large model key, optional)
136+
137+
---------E-Files---------
138+
dslings/hello-mcpp.cpp -->> Current detected file
139+
-------------------------
140+
141+
Homepage: https://github.com/d2learn/xlings
142+
```
143+
144+
## 3. Resources and Communication
145+
146+
**Communication Group (Q):** 167535744
147+
148+
**Tutorial Discussion Section:** [https://forum.d2learn.org/category/20](https://forum.d2learn.org/category/20)
149+
150+
**xlings:** [https://github.com/d2learn/xlings](https://github.com/d2learn/xlings)
151+
152+
**Tutorial Repository:** [https://github.com/Sunrisepeak/mcpp-standard](https://github.com/Sunrisepeak/mcpp-standard)
153+
154+
**Tutorial Video Collection:** [https://space.bilibili.com/65858958/lists/5208246](https://space.bilibili.com/65858958/lists/5208246)

book/en/src/changelog.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# mcpp-standard Changelog
2+
3+
## 2025/09
4+
5+
---
6+
**C++11 - 11 - Inherited Constructors**
7+
8+
- **video:** [Bili](https://www.bilibili.com/video/BV1bspBzFEEC) / [Youtube](https://youtu.be/p7vbY8XUKnY?si=GZUn9GSW68aU94A6) / [Code](https://github.com/Sunrisepeak/mcpp-standard/blob/main/videos/cpp11/11-inherited-constructors.py)
9+
10+
## 2025/08
11+
12+
---
13+
**C++11 - 11 - Inherited Constructors**
14+
15+
- **[code-0](https://github.com/Sunrisepeak/mcpp-standard/blob/main/dslings/cpp11/11-inherited-constructors-0.cpp) / [code-1](https://github.com/Sunrisepeak/mcpp-standard/blob/main/dslings/cpp11/11-inherited-constructors-1.cpp) / [code-2](https://github.com/Sunrisepeak/mcpp-standard/blob/main/dslings/cpp11/11-inherited-constructors-2.cpp)** - 2025/08/29
16+
- **[book](https://sunrisepeak.github.io/mcpp-standard/cpp11/11-inherited-constructors.html)** - 2025/08/28
17+
- **video** - todo
18+
19+
---
20+
**C++11 - 10 - Delegating Constructors**
21+
22+
- **[video](https://www.bilibili.com/video/BV1zft3zSEER) / [anim-code](https://github.com/Sunrisepeak/mcpp-standard/blob/main/videos/cpp11/10-delegating-constructors.py)** - 2025/08/04
23+
- **[code-0](https://github.com/Sunrisepeak/mcpp-standard/blob/main/dslings/cpp11/10-delegating-constructors-0.cpp) / [code-1](https://github.com/Sunrisepeak/mcpp-standard/blob/main/dslings/cpp11/10-delegating-constructors-1.cpp)** - 2025/08/02
24+
- **[book](https://github.com/Sunrisepeak/mcpp-standard/blob/main/book/src/cpp11/10-delegating-constructors.md)** - 2025/08/01
25+
26+
**Practice Detection Command**
27+
28+
```bash
29+
d2x checker delegating-constructors
30+
```

0 commit comments

Comments
 (0)