3 ms·
Why hate templates?
by colmvp 8y ago
Why hate templates?
- mianos 8y agoCompilation times? Obfuscation? Bloat? I like them but these are valid negatives.
- llukas 8y agoThose are problem only if templates are misused (imho).
- Something1234 8y agoWhich is pretty much anything outside of the STL library's basic usage.
- mianos 8y agoYes I agree. I would not have been so down-voted so much if I had said the use of templates in the std:: libraries and some others, not all, is fantastic. But, the use of templates to make generic code when it does not need to be leads to the same functionality as specialised classes with longer compile times and obfuscation.
- llukas 8y agoI agree that putting templates where they not belong causes problems (even more than just longer compile times and obfuscation). However, properly designed templates with enough attention put into exposing functionality beat non-templated approaches right off the bat. Example: http://eigen.tuxfamily.org/dox/TopicInsideEigenExample.html http://eigen.tuxfamily.org/dox/TopicInsideEigenExample.html