|
6 | 6 | \center ``members'' grouped together under one name |
7 | 7 | \end{mdframed} |
8 | 8 | \begin{multicols}{2} |
9 | | - \begin{cppcode*}{gobble=2} |
| 9 | + \begin{cppcode*}{} |
10 | 10 | struct Individual { |
11 | 11 | unsigned char age; |
12 | 12 | float weight; |
|
21 | 21 | }; |
22 | 22 | \end{cppcode*} |
23 | 23 | \columnbreak |
24 | | - \begin{cppcode*}{gobble=2,firstnumber=14} |
| 24 | + \begin{cppcode*}{firstnumber=14} |
25 | 25 | Individual *ptr = &student; |
26 | 26 | ptr->age = 25; |
27 | 27 | // same as: (*ptr).age = 25; |
|
56 | 56 | \center ``members'' packed together at same memory location |
57 | 57 | \end{mdframed} |
58 | 58 | \begin{multicols}{2} |
59 | | - \begin{cppcode*}{gobble=2} |
| 59 | + \begin{cppcode*}{} |
60 | 60 | union Duration { |
61 | 61 | int seconds; |
62 | 62 | short hours; |
|
104 | 104 | \end{itemize} |
105 | 105 | \end{block} |
106 | 106 | \begin{multicols}{2} |
107 | | - \begin{cppcode*}{gobble=2} |
| 107 | + \begin{cppcode*}{} |
108 | 108 | enum VehicleType { |
109 | 109 |
|
110 | 110 | BIKE, // 0 |
|
114 | 114 | VehicleType t = CAR; |
115 | 115 | \end{cppcode*} |
116 | 116 | \columnbreak |
117 | | - \begin{cppcode*}{gobble=2,firstnumber=8} |
| 117 | + \begin{cppcode*}{firstnumber=8} |
118 | 118 | enum VehicleType |
119 | 119 | : int { // C++11 |
120 | 120 | BIKE = 3, |
|
158 | 158 | \begin{frame}[fragile] |
159 | 159 | \frametitlecpp[98]{More sensible example} |
160 | 160 | \begin{multicols}{2} |
161 | | - \begin{cppcode*}{gobble=2} |
| 161 | + \begin{cppcode*}{} |
162 | 162 | enum class ShapeType { |
163 | 163 | Circle, |
164 | 164 | Rectangle |
|
171 | 171 | \end{cppcode*} |
172 | 172 | \columnbreak |
173 | 173 | \pause |
174 | | - \begin{cppcode*}{gobble=2,firstnumber=10} |
| 174 | + \begin{cppcode*}{firstnumber=10} |
175 | 175 | struct Shape { |
176 | 176 | ShapeType type; |
177 | 177 | union { |
|
183 | 183 | \end{multicols} |
184 | 184 | \pause |
185 | 185 | \begin{multicols}{2} |
186 | | - \begin{cppcode*}{gobble=2,firstnumber=17} |
| 186 | + \begin{cppcode*}{firstnumber=17} |
187 | 187 | Shape s; |
188 | 188 | s.type = |
189 | 189 | ShapeType::Circle; |
190 | 190 | s.radius = 3.4; |
191 | 191 |
|
192 | 192 | \end{cppcode*} |
193 | 193 | \columnbreak |
194 | | - \begin{cppcode*}{gobble=2,firstnumber=20} |
| 194 | + \begin{cppcode*}{firstnumber=20} |
195 | 195 | Shape t; |
196 | 196 | t.type = |
197 | 197 | Shapetype::Rectangle; |
|
205 | 205 | \frametitle{typedef and using \hfill \cpp98 / \cpp11} |
206 | 206 | Used to create type aliases |
207 | 207 | \begin{alertblock}{\cpp98} |
208 | | - \begin{cppcode*}{gobble=2} |
| 208 | + \begin{cppcode*}{} |
209 | 209 | typedef std::uint64_t myint; |
210 | 210 | myint count = 17; |
211 | 211 | typedef float position[3]; |
212 | 212 | \end{cppcode*} |
213 | 213 | \end{alertblock} |
214 | 214 | \begin{exampleblock}{\cpp11} |
215 | | - \begin{cppcode*}{gobble=2,firstnumber=4} |
| 215 | + \begin{cppcode*}{firstnumber=4} |
216 | 216 | using myint = std::uint64_t; |
217 | 217 | myint count = 17; |
218 | 218 | using position = float[3]; |
|
0 commit comments