Macros are a text substitution mechanism.
Templates are a functional turing-complete language that is executed at compile time and is integrated into the C++ type system. You can think of them as a plugin mechanism for the language.
More Related Contents:
- C++ type registration at compile time trick
- How do I implement no-op macro (or template) in C++?
- C++11 does not deduce type when std::function or lambda functions are involved
- Why can’t the template argument be deduced when it is used as template parameter to another template?
- How to detect whether there is a specific member variable in class?
- Why not infer template parameter from constructor?
- Explicit specialization in non-namespace scope [duplicate]
- Explicit template instantiation – when is it used?
- Accessing inherited variable from templated parent class [duplicate]
- SFINAE to check for inherited member functions
- C++ Static member initialization (template fun inside)
- When to use std::forward to forward arguments?
- Inheritance and templates in C++ – why are inherited members invisible?
- Template specialization of a single method from a templated class
- Template class with template container
- Expansion with variadic templates [duplicate]
- Why can’t templates be within extern “C” blocks?
- Get index of a tuple element’s type?
- Best introduction to C++ template metaprogramming? [closed]
- Reason for using non-type template parameter instead of regular parameter?
- When instantiating a template, should members of its incomplete argument types be visible?
- Template default arguments
- Default template argument when using std::enable_if as templ. param.: why OK with two template functions that differ only in the enable_if parameter?
- compile time loops
- Class template for numeric types
- C++ class with template member variable
- C++ Template Metaprogramming – Is it possible to output the generated code?
- if / else at compile time in C++?
- Conditional compilation based on template values?
- How to test whether class B is derived from template family of classes