Overview
What is it?
C++ templates are a way to write generic programs that operate over multiple types. There are four forms of templates in C++:
- variable templates (useful for constants and type traits),
- template functions (useful for generic functions),
- template classes (useful for containers),
- template methods (useful when used with template classes but not useful at all without them).
Why do I want it?
C++ templates help you accomplish a lot of things.
-
What is it good for?: C++ is good when you have memory and performance constraints, as well as when you need to interface with different low-level hardware like GPUs and TPUs.
-
What is it not good for?: C++ is not good when you want to iterate fast, just want to write a quick program for single use, or when you are working with low-level hardware but don’t need access to existing C++ libraries.
-
What is it not yet good for?: C++ is not easy to write. It is an old language with multiple ways to do things and its toolchains are not as ergonomic as more modern languages. There is work being done in this area but progress remains slow.
Where should I go next?
Give your users next steps from the Overview. For example:
- Getting Started: Get started with C++
- Examples: Check out some example code!