[Insight-developers] template depth limit

Brad King brad.king@kitware.com
Thu, 28 Jun 2001 11:27:57 -0400 (EDT)


> Not to sound "anti-template" (even though I have never used them, right
> Bill!) ---
> 
> But should we reconsider an architecture which relies on such depth of
> templates?  It makes me a little uncomfortable.   Does anyone see a
> problem with this?
I agree that we should avoid hitting GCC's limit, even though it is easy
to extend.  Each level of template depth represents another template class
instantiation hidden inside another.  If we are hitting GCC's default
limit of 17, then that means the class is instantiating at least 17 other
template classes when it is used.  Usually a re-structuring of classes can
get around the problem.  I've encountered this many times in template
metaprogramming constructs.

-Brad