[Insight-users] TODO for AffineTransform::Rotate3D()

Lorensen, William E (Research) lorensen at crd.ge.com
Wed, 28 Jan 2004 08:48:32 -0500


Benjamin,
Thanks for the bug report. This was logged as Bug #550
(http://www.itk.org/Bug/bug.php?op=show&bugid=550&pos=0)
and fixed. The code is in the current cvs repository. I used the Concept
Checking facility.

Bill

-----Original Message-----
From: Benjamin King [mailto:king.benjamin at mh-hannover.de]
Sent: Tuesday, January 27, 2004 4:16 AM
To: ITK
Subject: [Insight-users] TODO for AffineTransform::Rotate3D()


Hello,

I came across the AffineTransform::Rotate3D() documentation and the author 
needs some sort of compile-time assertion depending on the template 
parameter NDimensions.
I bought "Modern C++ Design" by Andrei Alexandrescu some time ago and 
never since dared to read more than the first few pages. Fortunately 
compile-time assertions are already done on page 25 of this amazing book 
=). See for yourself (credit of course goes to Andrei):

   template<bool> struct CompileTimeError;
   template<> struct CompileTimeError<true> { };
   #define STATIC_CHECK(expr, msg) {CompileTimeError<(expr) != 0> 
ERROR_##msg; (void)ERROR_##msg;}

Only the spezialization for 'true' of the bool templated 
CompileTimeError-class can be instatiated. This is exactly what the 
STATIC_CHECK macro tries to do. If you call it with an expression that 
evaluates to false at compile time, the compiler will tell that 
construction of the variable ERROR_##msg failed.
I have no idea what that '(void)ERROR_##msg;' is needed for. I think it's 
there to prevent a (useless) construction in cases where the assertion 
holds.

You will find pointers to this and other code from the book on 
http://www.moderncppdesign.com

HIH,
   Benjamin

-- 
Benjamin King
Institut fur Medizinische Informatik
Medizinische Hochschule Hannover
Tel.: +49  511  532-2663
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users