[Insight-developers] RE: ImageBase (Dimension template)

Miller, James V (CRD) millerjv@crd.ge.com
Wed, 21 Feb 2001 13:55:56 -0500


Luis,

I have no idea why this would work and the original approach wouldn't.  This was just a shot in the
dark. My hypothesis is that the compiler knows what an ImageTraits is, wheres it really didn't know
what a TImage was. When it see the ImageTraits, it has to expand that template right then in order to
proceed. Once it expanded the template, it could get to enum it needed.

I'm guessing this falls under "template metaprogramming".  But it seems to be a restricted enough
case that it works. I'll be checking whether it really works on the remainder of the compilers this
afternoon.

Jim


-----Original Message-----
From: Luis Ibanez [mailto:ibanez@cs.unc.edu]
Sent: Wednesday, February 21, 2001 1:19 PM
To: Miller, James V (CRD); insight-developers@public.kitware.com
Subject: ImageBase (Dimension template)


Hi  Jim,

Nice trick the use of ImageTraits to
get access to the dimension. It works fine.

Just for the record, I would like to understand why
it works and the direct access to ImageDimension
doesn't.

It both cases we are accessing enums ?

Is this extra type forcing the enums to be initialized ?


Thanks


Luis