Template implementations are hard to maintain because they get compiled into your client's code. Templates also, by their very nature, tend to bloat the resulting object code. This guide provides design standards and conventions to increase code maintainability, and to reduce the memory footprint.
There are many possible designs for template; some are easier to write, while others share more of the implementation details. The best design depends upon the specifics of your code. This guide recommends a standard design, but also gives some alternatives for special circumstances.
- Definitions and conventions
-
- Sharing class template implementations
-
- The example class: an owning stack
-
- Sharing the implementation through private inheritance
-
- Sharing the implementation by delegating to a member
-
- Further reading
-