3 ms·
My main issue with template, aside from the slow compilation time, is that they are most of the time very difficult to read. And in my opinion, legibility is a
by stephc_int13 6y ago
My main issue with template, aside from the slow compilation time, is that they are most of the time very difficult to read.
And in my opinion, legibility is an extremely important feature when you're writing code that you plan to understand and maintain for years.
Writting less code is a nice-to-have, but if the cost is that it's a complete mess, I'm out.
- GuB-42 6y agoSimple templates are not that hard to read. They can be tricky to write if you have things like templates using templates and specialization. But once you get the compiler to understand what you want, reading the code is usually not a problem. Hell breaks loose when you start doing "metaprogramming". I did a bit of it and it felt like I was exploited the compiler in clever ways not intended by the original authors, SFINAE checks in particular. And to be honest, I think it is the case, or some people should have their head checked. From the look of it, some modern C++ features attempt to fix that mess, notably concepts in C++20.