So far, I have introduced templates programming step by step with some examples. I didn't explain many things by myself, I tried to show you how it works.
Bearing all of this in mind, it's time to go over the profits of templates and the reason of being so interesant.
- Templates are type-safe: The compiler is able to do the type checking before a error occurs.
- Easiness writing them: With just one class we may have an infinity number of uses
Remember the example of max, with which one we saved many definitions.
- Optimize the runtime by compiling time: This point, I'd like to flesh out through metaprogramming but stay with the idea.
- Good possibility to reuse code.
No comments:
Post a Comment