[Insight-developers] itk::Array has an implicit conversion from unsigned int????

kent williams norman-k-williams at uiowa.edu
Wed Mar 10 13:40:14 EST 2010


I ran into this today.  I thought I was dealing with a drop-in replacement
ITK class, but the old class defined a method/member variable like this:

itkSetMacro( MaximumNumberOfIterations, unsigned int);

and the new class did this:

itkSetMacro( MaximumNumberOfIterations, itk::Array<unsigned int>);

The unexpected thing was that this:

x->SetMaximumNumberOfIterations(50);

compiled without complaint.

When I debugged it, it turns out the second case is equivalent to

itk::Array<unsigned int> anonymousTemp(50);
x->SetMaximumNumberOfIterations(anonymousTemp);

My reaction when I discovered this was WTF? (or What the Frumious
Bandersnatch).

Where is the implicit conversion from unsigned int to itk::Array, and is
this even a desirable thing?



More information about the Insight-developers mailing list