Maintainability suggestions and best practices for template programming

Maintainability of templates is a problem. This is a simple fact, when you're working outside the community dedicated to generic libraries. I don't want my friends and colleagues to have to use Clang to run my code, simply because... well... then it's not really generic and portable, is it? But I do desperately want to be able to write some templated code now and then.

What are some tricks you use to make templated code more usable, more maintainable, and just outright more readable? Things like descriptive template arguments, enable-ifs, and similar little quirks of code style, all the way up to advice regarding things like which compilers support variadic templates or what template (anti-)patterns to avoid.

In short, what idioms should I avoid? Which should I lean on?
I want my code to be elegant but not too elegant.

Some resources I have found:
C++ FAQ
Error Decrypt
What are variadic templates?

7
задан Jake Kurzer 21 December 2010 в 22:12
поделиться