Templates are a powerful tool that can be used for generic programming, template metaprogramming, and code optimization, but this power implies a cost.
Detailed analysis and extensions to more general network optimization problems (epsilon-relaxation and network auction algorithms) are provided in his network optimization books 1991, and 1998.