Each answer should be around 2 pages long. You cannot fully answer my question by 1 page
1. Iterators and the STL As we saw, an iterator is a smart pointer that is used to traverse
(“iterate”) through a collection like a vector, deque, list, etc. We also saw that we can create
containers of our own and define iterators for them and give them the required potency. In the
STL iterators are the bridge that connects the containers to the algorithms
(see https://www.youtube.com/watch?v=2olsGf6JIkU for an excellent overview).
Give an overview of the structure of the STL and show how iterators are classified by the types
of operations they provide and how they are used in the STL to connect containers and
2. Traits and policies
When we looked at how the STL algorithms worked we saw that they make assumptions about
the iterators passed to the algorithms. The in the slist class the type information was embedded
in the class definition. In practice this is not always possible, for example, an array is a container
that does not provide the information required. This where traits come in the material is found on
the class website in the STL material abd in the section on templates.
Explain in detail, using examples, what trait classes are and how they are used. What are
policies, give examples and explain how they are used in C++
3. Cache friendly code If we are unaware of how our program interacts with underlying
hardware, especially memory, we can write programs that look like they are efficient but really
run slowly in practice. Watch the following video and explain the issues involved in writing
efficient, hardware aware code,
4.std::string We started the semester with an analysis and critique of an ancient String
implementation. Strings are still a very big deal. Watch this video
Explain in detail the problem it addresses and the various approaches to solving it.