Skip to content

Commit 03a1d50

Browse files
authored
Merge pull request #20 from oraqlle/dev
First five chapters of the book which covers: - Installation and setup of C++ tools - Simple beginner project - Common concepts like functions, variables, types and control flow - Making and using structs
2 parents 2423ecd + ecc4fe8 commit 03a1d50

File tree

169 files changed

+4139
-2042
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+4139
-2042
lines changed

Diff for: .codespellrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[codespell]
2+
builtin = clear,rare,names,informal,code
3+
check-filenames =
4+
check-hidden =
5+
skip = */.git,*/build, */book,*/prefix,*/.codespellrc
6+
quiet-level = 2
7+
ignore-regex = ^#include <(?:stdio)\.h>$
8+
ignore-words-list = thead,uint
9+

Diff for: .markdownlint.json

-5
This file was deleted.

Diff for: CODE_OF_CONDUCT.md

-132
This file was deleted.

Diff for: CONTRIBUTING.md

+61-46
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Contributing
22

33
Thank you for taking the time to contribute.
4-
Any and all contributions are always very much appreciated. However, to make sure the process of accepting patches goes for everyone (especially for the maintainer), you should try to follow these few simple guidelines when you contribute:
4+
Any and all contributions are always very much appreciated. However, to make sure the
5+
process of accepting patches goes for everyone (especially for the maintainer), you
6+
should try to follow these few simple guidelines when you contribute:
57

68
## Prerequisites
79

@@ -12,76 +14,89 @@ Any and all contributions are always very much appreciated. However, to make sur
1214

1315
1. Fork the repository.
1416
2. Create a new branch based on the `dev` branch (`git checkout -b <your_branch> dev`).
15-
If your contribution is a bug fix, you should name your branch `bugfix/xxx`;
16-
for a feature, it should be `feature/xxx` etc. Otherwise, just use your good
17-
judgment. Consistent naming of branches is appreciated since it makes the
18-
output of `git branch` easier to understand with a single glance.
17+
If your contribution is a bug fix, you should name your branch `bugfix/xxx`;
18+
for a feature, it should be `feature/xxx` etc. Otherwise, just use your good
19+
judgment. Consistent naming of branches is appreciated since it makes the
20+
output of `git branch` easier to understand with a single glance.
1921
3. Do your modifications on that branch.
20-
4. Make sure your modifications did not break anything by building and verifying the output using:
22+
4. Make sure your modifications did not break anything by building and verifying the
23+
output using:
2124

22-
```sh
23-
mdbook serve --open
24-
```
25+
```sh
26+
mdbook serve --open
27+
```
2528

2629
5. Commit your changes. Your commit message should start with a one line
27-
short description of the modifications, with the details and explanations
28-
of your modifications following in subsequent paragraphs or bullet points. If you address an issue, create a subtitle with the issues number and title followed by the changes involved in resolving the issue.
29-
Please limit your lines to about 78 characters in commit messages, since
30-
it makes the output easier to read in `git log`. Also, starting your commit
31-
message with a tag describing the nature of the commit is nice, since it
32-
makes the commit history easier to skim through. For commits that do not
33-
change any functionality (e.g. refactoring or fixing typos), the `[NFC]`
34-
tag (No Functionality Change) can be used. Here's an example of an
35-
acceptable commit message:
36-
37-
```txt
38-
[TAG] Refactor the interface
39-
40-
- Rename elem to contains
41-
- Rename subset to is_subset, and make is_subset applicable in infix notation
42-
43-
Issue (#12) - Add an at `at_key` method:
44-
- Added the `at_key` method
45-
- operator[] is now bound to at_key instead of find
46-
```
47-
48-
When applicable, please squash adjacent _wip_ commits into a single _logical_ commit.
49-
If your contribution has several logical commits, it's fine.
30+
short description of the modifications, with the details and explanations of your
31+
modifications following in subsequent paragraphs or bullet points. If you address an
32+
issue, create a subtitle with the issues number and title followed by the changes
33+
involved in resolving the issue. Please limit your lines to about 78 characters in commit
34+
messages, since it makes the output easier to read in `git log`. Also, starting your
35+
commit message with a tag describing the nature of the commit is nice, since it makes the
36+
commit history easier to skim through. For commits that do not change any functionality
37+
(e.g. refactoring or fixing typos), the `[NFC]` tag (No Functionality Change) can be
38+
used. Here's an example of an acceptable commit message:
39+
40+
```txt
41+
[TAG] Refactor the interface
42+
43+
- Rename elem to contains
44+
- Rename subset to is_subset, and make is_subset applicable in infix notation
45+
46+
Issue (#12) - Add an at `at_key` method:
47+
- Added the `at_key` method
48+
- operator[] is now bound to at_key instead of find
49+
```
50+
51+
When applicable, please squash adjacent _wip_ commits into a single _logical_ commit. If
52+
your contribution has several logical commits, it's fine.
5053
6. Push the changes to your fork (`git push origin <your_branch>`).
5154
7. Open a pull request against the package's `dev` branch (not against `main`).
5255

53-
I will do my best to respond in a timely manner. I might discuss your patch and suggest some modifications, or I might amend your patch myself and ask you for feedback.
54-
You will always be given proper credit.
56+
I will do my best to respond in a timely manner. I might discuss your patch and suggest
57+
some modifications, or I might amend your patch myself and ask you for feedback. You will
58+
always be given proper credit.
5559

5660
## Style guide
5761

58-
Markdown uses the CommonMark style guide for the most part however, certain exceptions are allowed for customizing the style. It is a guide for a reason.
62+
Markdown uses the CommonMark style guide for the most part however, certain exceptions
63+
are allowed for customizing the style. It is a guide for a reason.
5964

60-
- Any code example should have a corresponding example link that is either a full file/project or a link to an external compiler (eg. Godbolt).
61-
- Any free standing or example links that are related should be put in a bullet-list and separate unrelated links by a empty line.
62-
- Reserve the use of quote blocks (lines beginning with `>` in Markdown) for side notes relating to content or examples
65+
- Any code example should have a corresponding example link that is either a full
66+
file/project or a link to an external compiler (eg. Godbolt).
67+
- Any free standing or example links that are related should be put in a bullet-list and
68+
separate unrelated links by a empty line.
69+
- Reserve the use of quote blocks (lines beginning with `>` in Markdown) for side notes
70+
relating to content or examples
6371

6472
For C++ content such as examples:
6573

6674
- Indent using 4 spaces.
6775
- Do not leave trailing white spaces at the end of lines, and no more than a
68-
single newline at the end of a source file.
69-
- A definition blocks' initial brace should start on a newline, not trail off the declaration.
70-
- Prefer direct initialisation (`{}` over `=`) over assignment initialisation, especially for primitive types.
76+
single newline at the end of a source file.
77+
- A definition blocks' initial brace should start on a newline, not trail off the
78+
declaration.
79+
- Prefer direct initialisation (`{}` over `=`) over assignment initialisation, especially
80+
for primitive types.
7181
- Prefer brace-based initialisation for invoking a types constructor.
7282
- Use spaces on either side of constructor arguments when using braces (eg. `int{ _ }`).
73-
- Use `auto` as variable introducer and declare type explicitly in the brace initialiser or on right-hand-side of the assignment.
83+
- Use `auto` as variable introducer and declare type explicitly in the brace initialiser
84+
or on right-hand-side of the assignment.
7485
- Prefer trailing return types on functions over prefixed notation.
75-
- Prefer to separate functions declarations (eg. `constexpr auto`), signature, constant and reference qualifiers (classes), `noexcept` specification and return type on separate lines if function declaration gets too long. Indent the constant and references qualifiers, `noexcept` specification and return type if they are on a newline.
86+
- Prefer to separate functions declarations (eg. `constexpr auto`), signature, constant
87+
and reference qualifiers (classes), `noexcept` specification and return type on separate
88+
lines if function declaration gets too long. Indent the constant and references
89+
qualifiers, `noexcept` specification and return type if they are on a newline.
7690

7791
```cxx
7892
constexpr auto
7993
really_long_function_signature(that_takes lots_of_arguments, with_really long_names, for_types and_arguments)
80-
noexcept( noexcept(long_noexcept_specification) && noexcept(with_multiple_conditions) )
81-
-> a_really_long_return_type<with_lots<of_nested>, template_type<parameters, and_metaprogramming>>
94+
noexcept( noexcept(long_noexcept_specification) && noexcept(with_multiple_conditions) )
95+
-> a_really_long_return_type<with_lots<of_nested>, template_type<parameters, and_metaprogramming>>
8296
{}
8397
```
8498
8599
- Indent `requires` clauses and `requires` expressions.
86100
- `#include` should be sorted in alphabetical order.
87-
- Mostly use your own judgment and stick to the style of the existing and surrounding code.
101+
- Mostly use your own judgment and stick to the style of the existing and surrounding
102+
code.

Diff for: README.md

-5
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,3 @@ $ mdbook serve --open
3131

3232
Refer to the [Code of Conduct](/CODE_OF_CONDUCT.md) and the [License](/LICENSE) for this repository for the expected behavior of contributors and users of the repository. If you have any concerns reach out to me (Tyler Swann) on Teams or follow standard M procedures for issues you are having within the team, branch or MDN. If you wish to contribute, follow the [contributing guide](/CONTRIBUTING.md).
3333

34-
## TODO
35-
36-
- [ ] Only cover basic structs (no constructors) in chapter 5.
37-
- [ ] Move old chapter 5 topics to after chapter 6
38-

Diff for: src/SUMMARY.md

+31-24
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,42 @@
55

66
## Getting Started
77

8-
- [Getting Started](getting-started/getting-started.md)
9-
- [Installation](getting-started/installation.md)
10-
- [Linux](getting-started/linux.md)
11-
- [Windows](getting-started/windows.md)
12-
- [MacOS](getting-started/macos.md)
13-
- ["Hello, World!"](getting-started/hello-world.md)
14-
- ["Hello, CMake!"](getting-started/hello-cmake.md)
15-
- ["Hello, vcpkg!"](getting-started/hello-vcpkg.md)
16-
- ["Hello, Godbolt!"](getting-started/hello-godbolt.md)
8+
- [Getting Started](ch01-getting-started/getting-started.md)
9+
- [Installation](ch01-getting-started/installation.md)
10+
- [Linux](ch01-getting-started/linux.md)
11+
- [Windows](ch01-getting-started/windows.md)
12+
- [MacOS](ch01-getting-started/macos.md)
13+
- ["Hello, World!"](ch01-getting-started/hello-world.md)
14+
- ["Hello, CMake!"](ch01-getting-started/hello-cmake.md)
15+
- ["Hello, vcpkg!"](ch01-getting-started/hello-vcpkg.md)
16+
- ["Hello, Godbolt!"](ch01-getting-started/hello-godbolt.md)
1717

1818
## Sample Project
1919

20-
- [Project: Guessing Game](getting-started/guessing-game.md)
20+
- [Project: Guessing Game](ch02-guessing-game/guessing-game.md)
2121

2222
## Common Programming Concepts
2323

24-
<!-- - [Common Programming Concepts](common-concepts/common-concepts.md) -->
25-
<!-- - [Variables and Mutability](common-concepts/vars-mut.md) -->
26-
<!-- - [Data Types](common-concepts/data-types.md) -->
27-
<!-- - [Functions](common-concepts/functions.md) -->
28-
<!-- - [Comments](common-concepts/comments.md) -->
29-
<!-- - [Control Flow](common-concepts/control-flow.md) -->
24+
- [Common Programming Concepts](ch03-common-concepts/common-concepts.md)
25+
- [Variables and Mutability](ch03-common-concepts/vars-mut.md)
26+
- [Data Types](ch03-common-concepts/data-types.md)
27+
- [Functions](ch03-common-concepts/functions.md)
28+
- [Comments](ch03-common-concepts/comments.md)
29+
- [Control Flow](ch03-common-concepts/control-flow.md)
3030

3131
## Ownership
3232

33-
<!-- - [Ownership](ownership/ownership.md) -->
34-
<!-- - [What is ownership?](ownership/what-is-it.md) -->
35-
<!-- - [References and Moves](ownership/refs-moves.md) -->
36-
<!-- - [Spans](ownership/spans.md) <!-- and std::string_view --> -->
33+
- [Ownership](ch04-ownership/ownership.md)
34+
- [What is ownership?](ch04-ownership/what-is-it.md)
35+
- [References and Moves](ch04-ownership/refs-moves.md)
36+
- [The span and string_view types](ch04-ownership/span.md)
37+
38+
## Structures
39+
40+
- [Structures](ch05-structures/structures.md)
41+
- [Creating Structures](ch05-structures/create.md)
42+
- [Using Structures](ch05-structures/example.md)
43+
- [Methods](ch05-structures/methods.md)
3744

3845
## Containers
3946

@@ -177,7 +184,7 @@
177184
<!-- - [Date and Time](time/date-time.md) -->
178185
<!-- - [Clocks and Time](time/clocks.md) -->
179186
<!-- - [Timezones](time/timezones.md) -->
180-
<!-- - [Calenders](time/calendars.md) -->
187+
<!-- - [Calendars](time/calendars.md) -->
181188
<!-- - [Locales](time/locales.md) -->
182189

183190
## Regex
@@ -186,9 +193,9 @@
186193

187194
## Appendix
188195

189-
<!-- - [Appendix](appendix/appendicies.md) -->
190-
<!-- - [A - Keywords](appendix/keywords.md) -->
191-
<!-- - [B - Operators](appendix/operators.md) -->
196+
- [Appendix](appendix/appendix.md)
197+
- [A - Keywords](appendix/A-keywords.md)
198+
- [B - Operators](appendix/B-operators.md)
192199
<!-- - [C - Developer Tools](appendix/devtools.md) -->
193200
<!-- - [D - Standard Versions](appendix/standard-versions.md) -->
194201
<!-- - [E - Value Categories](appendix/value-categories.md) -->

Diff for: src/algorithms/algorithms.md

-5
This file was deleted.

0 commit comments

Comments
 (0)