Commit 0ab68930 authored by Alexander Hirsch's avatar Alexander Hirsch

Add ex06

parent 8b82e0db
......@@ -12,7 +12,7 @@
| 2019-11-19 | [New Tools in a Familiar Context (cont.)] | [rr15] | 15:15–17:00 |
| 2019-11-26 | [Class Essentials and Libraries] | [rr15] | Inday Students |
| 2019-12-03 | [More of This and That] | [rr15] | |
| 2019-12-10 | | [rr15] | |
| 2019-12-10 | [Same Same but Different] | [rr15] | |
| 2020-01-07 | | [rr15] | |
| 2020-01-14 | | [rr15] | |
| 2020-01-21 | | [rr15] | |
......@@ -24,6 +24,7 @@
[New Tools in a Familiar Context (cont.)]: ex03
[Class Essentials and Libraries]: ex04
[More of This and That]: ex05
[Same Same but Different]: ex06
[rr15]: https://www.uibk.ac.at/zid/raeume/architekturgebaeude/rr15.html
......
# Exercise Sheet 6 — Same Same but Different
*due on 10 December 2019*
## Task 1 (4 Points)
Implement your own version of `std::vector` without using any of the provided containers — use *regular arrays* (`new[]` / `delete[]`) to house your elements.
The focus of this task lies on the use of templates.
You do not have to concern yourself with custom allocators and iterators (see task 2).
Test your implementation with different types (`int`, `double`, and a custom struct).
## Task 2 (2 Points)
Take your vector from task 1 and implement iterators.
You might want to read through the respective documentation.
Write some tests utilising algorithms provided by the standard library to check if your iterators behave correctly.
## Task 3 (1 Points)
Take your vector from task 1 and implement iterators.
Instantiate the template at least twice with different types.
Examine the resulting object file using `nm`.
Measure the relationship between compile time and number of unique template instantiations.
Prepare a scatter plot for presentation.
## Task 4 (3 Points)
Read [this blog post](https://www.gamedev.net/blogs/entry/2265481-oop-is-dead-long-live-oop).
Prepare a short summary, paying special attention to the use of templates.
What benefits and drawbacks do you identify?
## Task 5 (2 Points)
Take your vector from task 1 and implement componentwise addition via `operator+` on your vector.
Support implicit type conversions: `MyVector<int>{} + MyVector<double>{}` yields a `MyVector<double>`.
*Hint:* Look into `decltype` and `std::declval`.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment