Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: