Skip to content

Commit 75f0463

Browse files
committed
remove all mentions of Fragments type alias
1 parent 3f79050 commit 75f0463

File tree

4 files changed

+106
-109
lines changed

4 files changed

+106
-109
lines changed

week2A.md

Lines changed: 17 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,9 @@ This is what our `fragments.h` file should look like:
142142
#include <vector>
143143
#include <string>
144144
145-
using Fragments = std::vector<std::string>;
145+
std::vector<std::string> load_fragments (const std::string& filename);
146146
147-
Fragments load_fragments (const std::string& filename);
148-
149-
void fragment_statistics (const Fragments& fragments);
147+
void fragment_statistics (const std::vector<std::string>& fragments);
150148
151149
void write_sequence (const std::string& filename, const std::string& sequence);
152150
```
@@ -164,11 +162,9 @@ This is what our `fragments.h` file should look like:
164162
#include <vector>
165163
#include <string>
166164
167-
using Fragments = std::vector<std::string>;
168-
169-
Fragments load_fragments (const std::string& filename);
165+
std::vector<std::string> load_fragments (const std::string& filename);
170166
171-
void fragment_statistics (const Fragments& fragments);
167+
void fragment_statistics (const std::vector<std::string>& fragments);
172168
173169
void write_sequence (const std::string& filename, const std::string& sequence);
174170
```
@@ -192,11 +188,9 @@ This is what our `fragments.h` file should look like:
192188
*#include <vector>
193189
*#include <string>
194190
195-
using Fragments = std::vector<std::string>;
191+
std::vector<std::string> load_fragments (const std::string& filename);
196192
197-
Fragments load_fragments (const std::string& filename);
198-
199-
void fragment_statistics (const Fragments& fragments);
193+
void fragment_statistics (const std::vector<std::string>& fragments);
200194
201195
void write_sequence (const std::string& filename, const std::string& sequence);
202196
```
@@ -223,38 +217,9 @@ This is what our `fragments.h` file should look like:
223217
#include <vector>
224218
#include <string>
225219
226-
*using Fragments = std::vector<std::string>;
227-
228-
Fragments load_fragments (const std::string& filename);
229-
230-
void fragment_statistics (const Fragments& fragments);
231-
232-
void write_sequence (const std::string& filename, const std::string& sequence);
233-
```
234-
235-
236-
.explain-bottom[
237-
We also include our type alias &ndash; otherwise the compiler won't know what
238-
we mean by `Fragments`
239-
]
240-
241-
---
242-
243-
# Splitting projects over multiple files
244-
245-
This is what our `fragments.h` file should look like:
246-
247-
```
248-
#pragma once
249-
250-
#include <vector>
251-
#include <string>
252-
253-
using Fragments = std::vector<std::string>;
254-
255-
*Fragments load_fragments (const std::string& filename);
220+
*std::vector<std::string> load_fragments (const std::string& filename);
256221
*
257-
*void fragment_statistics (const Fragments& fragments);
222+
*void fragment_statistics (const std::vector<std::string>& fragments);
258223
*
259224
*void write_sequence (const std::string& filename, const std::string& sequence);
260225
```
@@ -280,11 +245,11 @@ This is what our `fragments.cpp` file should look like:
280245
281246
#include "fragments.h"
282247
283-
Fragments load_fragments (const std::string& filename)
248+
std::vector<std::string> load_fragments (const std::string& filename)
284249
{ ...
285250
}
286251
287-
void fragment_statistics (const Fragments& fragments)
252+
void fragment_statistics (const std::vector<std::string>& fragments)
288253
{ ...
289254
}
290255
@@ -306,11 +271,11 @@ This is what our `fragments.cpp` file should look like:
306271
307272
#include "fragments.h"
308273
309-
Fragments load_fragments (const std::string& filename)
274+
std::vector<std::string> load_fragments (const std::string& filename)
310275
{ ...
311276
}
312277
313-
void fragment_statistics (const Fragments& fragments)
278+
void fragment_statistics (const std::vector<std::string>& fragments)
314279
{ ...
315280
}
316281
@@ -337,11 +302,11 @@ This is what our `fragments.cpp` file should look like:
337302
338303
*#include "fragments.h"
339304
340-
Fragments load_fragments (const std::string& filename)
305+
std::vector<std::string> load_fragments (const std::string& filename)
341306
{ ...
342307
}
343308
344-
void fragment_statistics (const Fragments& fragments)
309+
void fragment_statistics (const std::vector<std::string>& fragments)
345310
{ ...
346311
}
347312
@@ -368,11 +333,11 @@ This is what our `fragments.cpp` file should look like:
368333
369334
#include "fragments.h"
370335
371-
*Fragments load_fragments (const std::string& filename)
336+
*std::vector<std::string> load_fragments (const std::string& filename)
372337
*{ ...
373338
*}
374339
*
375-
*void fragment_statistics (const Fragments& fragments)
340+
*void fragment_statistics (const std::vector<std::string>& fragments)
376341
*{ ...
377342
*}
378343
*
@@ -1851,7 +1816,7 @@ Exercise: add a function to your code to:
18511816
# Possible solution
18521817

18531818
```
1854-
std::string extract_longest_fragment (Fragments& fragments)
1819+
std::string extract_longest_fragment (std::vector<std::string>& fragments)
18551820
{
18561821
unsigned int size_of_longest = 0;
18571822
unsigned int index_of_longest = 0;

week2B.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,7 +2195,7 @@ We now have all the pieces required to implement our verbose option
21952195
For example, in `fragments.cpp`:
21962196
```
21972197
...
2198-
Fragments load_fragments (const std::string& filename)
2198+
std::vector<std::string> load_fragments (const std::string& filename)
21992199
{
22002200
* if (debug::verbose)
22012201
std::cerr << "reading fragments from file \"" << filename << "\"...\n";
@@ -2204,7 +2204,7 @@ Fragments load_fragments (const std::string& filename)
22042204

22052205
--
22062206

2207-
.explain-bottom[
2207+
.explain-bottomright[
22082208
Exercise: implement these changes in your own code
22092209
]
22102210

@@ -2380,7 +2380,7 @@ mentioned above, the compiler is free to treat this merely as a *hint*
23802380
We can now use our convenience function in our code, for example in `fragments.cpp`:
23812381
```
23822382
...
2383-
Fragments load_fragments (const std::string& filename)
2383+
std::vector<std::string> load_fragments (const std::string& filename)
23842384
{
23852385
* if (debug::verbose)
23862386
* std::cerr << "reading fragments from file \"" << filename << "\"...\n";
@@ -2389,7 +2389,7 @@ Fragments load_fragments (const std::string& filename)
23892389
becomes simply:
23902390
```
23912391
...
2392-
Fragments load_fragments (const std::string& filename)
2392+
std::vector<std::string> load_fragments (const std::string& filename)
23932393
{
23942394
* debug::log ("reading fragments from file \"" + filename + "\"...");
23952395
...

0 commit comments

Comments
 (0)