From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-02-09 00:00:24
I'm working on some code which if naively implemented would
involve deep template nesting. Since I can't get a version using MPL
algorithms to work on BCC 5.5.1 or VC6 , I wrote out the algorithm
with hand-coded loop unrolling.
It worked beautifully on a whole bunch of compilers, but when I
tried it on GCC 2.95 I found I had to set the template nesting depth
to 34 to get it to compile. The same code worked on GCC 3.2 with the
depth restricted to 11. After making a few changes, I got the depth on
GCC 2.95 (and 3.2) down to 7. One of the changes I made was to switch
from using is_based_and_derived to a hand-rolled version restricted to
a particular base type. This last change eliminated 11 levels of
nesting on GCC 2.95 and 4 on GCC 3.2, although is_based_and_derived
had been used in only one place, with fairly simple types, at the
center of the algorithm.
So I am wondering: is GCC 2.9x known to to be wasteful with respect to
template nesting? Also, are the workarounds for GCC 2.9x in Type
Traits or MPL known to add a lot of extra template nesting?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk