See Example at the end of the page for a examples of max, min, and swap templates. See Answer at the end of the page. This is a very economical way of creating standard data structures like stacks and queues. You can avoid to put a lot of work into high quality programming because it can be used in many different projects. Once written a template can be used in many projects.
Templates are often easy to program.
And the compiler can easily generate vectors, stacks, lists, queues, and other useful data structures for you. Separate Compilation Many compilers have a problem with separately compiled templates. They can not make use of a compiled template to generate a special version. This means that templates must be declared in the code where they are used. This is an exception to my general rule.