3 ms·
It's about when you want to enable optimisations or conveniences depending on the parameterized type. For example, in the std::vector<T> type, if T supports be
by widdershins 3y ago
It's about when you want to enable optimisations or conveniences depending on the parameterized type.
For example, in the std::vector<T> type, if T supports being moved, you want to use that when growing your vector for performance. If T doesn't support being moved, you will have to copy it instead.
Boom: you've ended up with template metaprogramming.