Re: Do C++ Programmers Overuse Templates?
On Dec 5, 11:08 am, dertop...@web.de wrote:
DerTop...@web.de wrote:
I think that templates are the most advanced concept of
C++, and thus -- as probably many in this thread will
agree to -- it is also one of the least understood feature
when you consider the majority of C++ programmers.
"least understood"? How difficult should "genericity" be?
(Apparently I just indicted it. Oh well).
Maybe we should differentiate between different techniques
that are used with template programming: Surely everyone will
agree that the container classes of the STL are plain and
simple. It gets a bit more complicated when you consider
traits. Probably the most complicated thing is the heavy use
of SFINAE (like it is done in boost), the CRTP, or
Koenige-Lookup (which is not strictly a template-related
problem but plays a role in template programming). Maybe we
should consider policies like
"Template programming is okay, but no use of SFINAE, CRTP, and
other techniques that are beyond the common skills of our
team".
Maybe that should be rephrased to say that no code should use
techniques that are beyond the reasonably expected skills of
those who will have to maintain it. Templates aren't the only
issue. And different parts of a project will (or should be)
maintained by people with different skill sets; the quants here
do things I couldn't do, and vice versa. The application level
code written by the quants probably should not define templates,
period. In the low level code I tend to work on, on the other
hand, simple use of SFINAE isn't a problem.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34