Skip to content

Commit bf04222

Browse files
authored
Merge branch 'master' into Issue3
2 parents 5082bea + ab3c4be commit bf04222

File tree

4 files changed

+196
-2
lines changed

4 files changed

+196
-2
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Collect git metadata
2424
id: git_metadata
2525
run: |
26-
echo "{VERSION}::{${GITHUB_REF#refs/tags/v}}" >> $GITHUB_OUTPUT
26+
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
2727
# The following builds the document in multiple formats for deployment.
2828
- name: Build the document.
2929
shell: bash
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Module name: Passing Parameters by Reference
2+
_Skeleton descriptions are typeset in italic text,_
3+
_so please don't remove these descriptions when editing the topic._
4+
5+
## Overview
6+
7+
_Provides a short natural language abstract of the module’s contents._
8+
_Specifies the different levels of teaching._
9+
10+
<table>
11+
<thead>
12+
<th>Level</th>
13+
<th>Objectives</th>
14+
</thead>
15+
<tr>
16+
<td>Foundational</td>
17+
<td>Avoiding copies using const-reference modifiers</td>
18+
</tr>
19+
<tr>
20+
<td>Main</td>
21+
<td>Using references to modify external data</td>
22+
</tr>
23+
<tr>
24+
<td>Advanced</td>
25+
<td></td>
26+
</tr>
27+
</table>
28+
29+
## Motivation
30+
31+
_Why is this important?_
32+
_Why do we want to learn/teach this topic?_
33+
34+
## Topic introduction
35+
36+
_Very brief introduction to the topic._
37+
38+
Explain what a reference type is and how it constrasts with a value type.
39+
40+
## Foundational: Using reference types to avoid copies
41+
42+
### Background/Required Knowledge
43+
44+
A student is able to:
45+
46+
* Define and call a function with parameters
47+
48+
### Student outcomes
49+
50+
_A list of things "a student should be able to" after the curriculum._
51+
_The next word should be an action word and testable in an exam._
52+
_Max 5 items._
53+
54+
A student should be able to:
55+
56+
1. Use const-refernce types for function arguments
57+
2. Explain what considerations to take when deciding whether or not to use a const-reference type
58+
59+
### Caveats
60+
61+
_This section mentions subtle points to understand, like anything resulting in
62+
implementation-defined, unspecified, or undefined behavior._
63+
64+
### Points to cover
65+
66+
_This section lists important details for each point._
67+
68+
* No copy of the data is made when taken by constant reference
69+
* A constant reference value cannot be modified
70+
* The lifetime of a constant reference cannot be expected to extend beyond the lifetime of the function, so the reference should not be saved off for future use.
71+
* Taking a reference is not always a time or space savings. Modern machines may use 8-bytes to reference a 4-byte integer, for instance.
72+
73+
## Main: Using references to modify external data
74+
75+
### Background/Required Knowledge
76+
77+
* All of the above
78+
79+
### Student outcomes
80+
81+
A student should be able to:
82+
83+
1. Define and utilize a non-const reference for passing values out of a function
84+
85+
### Caveats
86+
87+
### Points to cover
88+
89+
* If the function does not intend to modify the value, const-references should be preferred
90+
* A reference value may be modified
91+
* The lifetime of a reference cannot be expected to extend beyond the lifetime of the function, so the reference should not be saved off for future use.
92+
* Taking a reference is not always a time or space savings. Modern machines may use 8-bytes to reference a 4-byte integer, for instance.
93+
94+
## Advanced
95+
96+
_These are important topics that are not expected to be covered but provide
97+
guidance where one can continue to investigate this topic in more depth._
98+
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Module name: Passing Parameters by Value
2+
_Skeleton descriptions are typeset in italic text,_
3+
_so please don't remove these descriptions when editing the topic._
4+
5+
## Overview
6+
7+
_Provides a short natural language abstract of the module’s contents._
8+
_Specifies the different levels of teaching._
9+
10+
<table>
11+
<thead>
12+
<th>Level</th>
13+
<th>Objectives</th>
14+
</thead>
15+
<tr>
16+
<td>Foundational</td>
17+
<td>Defining and calling functions with values</td>
18+
</tr>
19+
<tr>
20+
<td>Main</td>
21+
<td></td>
22+
</tr>
23+
<tr>
24+
<td>Advanced</td>
25+
<td></td>
26+
</tr>
27+
</table>
28+
29+
## Motivation
30+
31+
_Why is this important?_
32+
_Why do we want to learn/teach this topic?_
33+
34+
The fundamental element for code-reuse is a function. For functions to be
35+
useful, we need to parameterize them. Understanding how to do such is thus
36+
fundamental to programming in any language.
37+
38+
## Topic introduction
39+
40+
_Very brief introduction to the topic._
41+
42+
Explain how to define functions with parameters and call them with values.
43+
44+
## Foundational: Using reference types to avoid copies
45+
46+
### Background/Required Knowledge
47+
48+
A student is able to:
49+
50+
* Explain what a function is
51+
52+
### Student outcomes
53+
54+
_A list of things "a student should be able to" after the curriculum._
55+
_The next word should be an action word and testable in an exam._
56+
_Max 5 items._
57+
58+
A student should be able to:
59+
60+
1. Call a function with any number of parameters using the same number of arguments
61+
2. Define a function with any number of parameters
62+
63+
### Caveats
64+
65+
_This section mentions subtle points to understand, like anything resulting in
66+
implementation-defined, unspecified, or undefined behavior._
67+
68+
### Points to cover
69+
70+
_This section lists important details for each point._
71+
72+
* A function is called by invoking the name of the function, followed by parentheses
73+
* For each parameter in the function signature, a value must be provided, and in the same order
74+
* Multiple values passed to a function are comma-separated
75+
* When defining a function, you must list the parameters with the type first, and parameter name second
76+
77+
## Main: Using references to modify external data
78+
79+
### Background/Required Knowledge
80+
81+
### Student outcomes
82+
83+
### Caveats
84+
85+
### Points to cover
86+
87+
## Advanced
88+
89+
_These are important topics that are not expected to be covered but provide
90+
guidance where one can continue to investigate this topic in more depth._
91+

sources/modules/functions/user-defined-literals.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Functions: user-defined literals {#udl}
1+
## Functions: user-defined literals (UDL) {#udl}
22

33
_Skeleton descriptions are typeset in italic text,_
44
_so please don't remove these descriptions when editing the topic._
@@ -8,6 +8,11 @@ _so please don't remove these descriptions when editing the topic._
88
_Provides a short natural language abstract of the module’s contents._
99
_Specifies the different levels of teaching._
1010

11+
Literals are a way to write values in the code, such as strings and numbers.
12+
User-defined literals (UDL) allow to add a suffix to a string or number to change the meaning.
13+
The suffix selects a function (an operator) that can alter the value and type of the literal.
14+
The C++ library provides certain operators already and a user can add more by providing such operators.
15+
1116
-------------------------------------------------------------------------
1217
Level Objectives
1318
---------------- --------------------------------------------------------

0 commit comments

Comments
 (0)