3.1 Get some experience with lambda expressions in C++
This is an open exercise about lambda expressions in C++. Overall, the purpose is to get some practical experience with lambda expressions in C++, based on our knowledge of lambda expressions in functional programming languages.
One way to go: Write some small C++ programs that illustrate the various forms of capture as described in section 11.4.3 (page 293) in The C++ Prog. Lang. (4. edition).
Another way to go: Make some experiments with mapping, filtering, and accumulation supported by higher-order C++ functions and C++ lambda expressions. Feel free to use vectors, or another kind of container for your experiments. You may find inspiration in the PP lecture about higher-order functions.
A third way to go: Functions cannot be nested in C++. Do some research on nesting of lambda expression into each other.
Feel free to choose your own experiments!
3.2 String functions
3.3 Understand Vectors
Take a look at the documentation of the (template) class vector at www.cplusplus.com
Familiarize yourself with the vector member functions, and read some of the (numerous) small examples which are available
3.4 Understand the way we program and use output stream manipulators
Study the program on the accompanying slide in which we program our own stream manipulator.
First, read through the program (do it together with fellow students) and understand what happens.
Next, use the pattern to write a couple of new stream manipulators. If possible, make some which are more useful than the one I wrote. Maybe manipulators that affect the state of the stream, instead putting characters to the stream.
I recommend that you take a look at page 1087 in The C++ Prog. Lang. (4. edition).
Generated: Tuesday August 1, 2017, 13:27:06