Use std::vector in smartPointers and stl exercises ?
It is my strong feeling that the use of raw C arrays makes the syntax uselessly complex, and divert the learners from what we want to demonstrate. It would rather use std::vector, provided it has been previously presented in the morning lessons.
We have std::vector in the STL chapter, which comes before smart pointers, so we can use it for the exercises.
Do we also have std::array ?
We have a slide that lists all STL containers, including std::array. I told the students that std::array is similar to a C array but with a std::vector like interface. So in principle, they should not be too surprised seeing it.
However, if we now put STL algorithms and std::vector/std::array all in one or two exercises, that might be a bit too much.
I rather think that using the type double[] in the exercises, with the unusual way to use make_unique/shared, and the use of array addresse together with "address+size", instead of begin() and end(), is doing a great disservice to beginners. They should use std::array from the beginning, never more C arrays.
With vector, there is no need to put it on the heap. I would generally say that people should use vector, but you see that it defies the point of the exercise.
I'm very happy though if you want to replace the array with a std::array on the heap! Thoughts?
... the same for the array in LargeObject, problem2.
I generally use valarray in such a case, as a replacement for the stillborn gsl::dyn_array... but I understand that some developers dislike std::valarray.
This issue or pull request has been automatically marked as stale because it has not had recent activity. Please manually close it, if it is no longer relevant, or ask for help or support to help getting it unstuck. Let me bring this to the attention of @klieret @wdconinc @michmx for now.