What to do with students after templates were explained? [closed]
I'm having a C++ seminar in 30 minutes :-)
Because I incorporated most of the examples I usually do on the seminar into the lecture I don't have anything to do with my students. I jus开发者_如何学JAVAt gave them a broad overview of templates (from basics to advanced topics).
Any tips what to do?
It can be something that I will explain (step-by-step), or something they will have to code.
Replicate containers - like a list or a vector.
How about trying to implement templates that mirror or are similar to those currently in the STL?
It will give them practice in developing them.
You can challenge them with a "can-be-a-real-system"... and ask them what possible best-practices...
Once you've delivered the basics of templates, point them in the direction of the standard template library and have them get their head around using std::list, std::vector etc to store arrays of objects and iterate through them.
It's easier to implement your own template code, once you understand their advantages. So using the STL should be their next step.
After that, point them at boost ;)
If you haven't yet covered the STL, you could introduce them to that. It is a good example of why templates are extremely useful.
You could also introduce them to iterators using this approach. IMO, learning the STL is one of the most useful things you can learn in C++ :-)
精彩评论