[Insight-developers] A few minor consistency issues

Zachary Pincus zpincus at stanford.edu
Thu Jan 12 17:50:14 EST 2006


As it turns out, it's not a gcc4-specific issue. Some testing shows  
gcc3 is also affected, which I hadn't previously thought to be the case.

The same testing shows that even if I change the comparison to if 
(m_Functor == m_Functor), the darn thing won't compile. Why in the  
world  are the implicit operators not being produced, I wonder.

Zach



On Jan 12, 2006, at 2:11 PM, Bill Lorensen wrote:

> I have gcc4 on my home machine. I'll take a look tomorrow. For the  
> short term, go with your original fix. Remove the comparison.
> Keep the bug open and assign it to me.
>
> Thanks,
>
> Bill
>
> At 04:37 PM 1/12/2006, Zachary Pincus wrote:
>> Hmm, no luck -- the same error appears for operator==.
>>
>> Perhaps the question to be asking is why isn't gcc (I am using gcc4)
>> properly providing the implicit comparison operators for the functor
>> classes? Any thoughts?
>>
>> Zach
>>
>>
>> Here's some test code:
>> #include "itkTernaryAddImageFilter.h"
>> #include "itkImage.h"
>>
>> const unsigned int Dimension = 2;
>> typedef unsigned short PixelType;
>> typedef itk::Image<PixelType, Dimension>  ImageType;
>> typedef itk::TernaryAddImageFilter<ImageType, ImageType, ImageType,
>> ImageType> AddImageType;
>>
>> int main(int argc, char *argv[]) {
>>   AddImageType::Pointer adder = AddImageType::New();
>>   adder->SetFunctor(adder->GetFunctor());
>>
>>         return 0;
>> }
>>
>> For reference, the Add3 functor used by this filter is defined as:
>> template< class TInput1, class TInput2, class TInput3, class TOutput>
>> class Add3
>> {
>> public:
>>   Add3() {}
>>   ~Add3() {}
>>   inline TOutput operator()( const TInput1 & A,
>>                              const TInput2 & B,
>>                              const TInput3 & C)
>>   { return (TOutput)(A + B + C); }
>> };
>>
>>
>> Which generates the following error:
>> Insight/Code/BasicFilters/itkTernaryFunctorImageFilter.h: In member
>> function 'void itk::TernaryFunctorImageFilter<TInputImage1,
>> TInputImage2, TInputImage3, TOutputImage, TFunction>::SetFunctor  
>> (const TFunction&) [with TInputImage1 = ImageType, TInputImage2 =
>> ImageType, TInputImage3 = ImageType, TOutputImage = ImageType,
>> TFunction = itk::Function::Add3<PixelType, PixelType, PixelType,
>> PixelType>]':
>> /Users/zpincus/Documents/Research/Theriot Lab/Development/Scratch/  
>> Ternary Test/writer.cxx:13:   instantiated from here
>> /Developer/Local/ITK-CVS/Insight/Code/BasicFilters/  
>> itkTernaryFunctorImageFilter.h:95: error: no match for 'operator=='
>> in 'functor == ((itk::TernaryFunctorImageFilter<ImageType, ImageType,
>> ImageType, ImageType, itk::Function::Add3<PixelType, PixelType,
>> PixelType, PixelType> >*)this)-  
>> >itk::TernaryFunctorImageFilter<ImageType, ImageType, ImageType,
>> ImageType, itk::Function::Add3<PixelType, PixelType, PixelType,
>> PixelType> >::m_Functor'
>>
>> This is the same error as when using operator!=.
>>
>> _______________________________________________
>> Insight-developers mailing list
>> Insight-developers at itk.org
>> http://www.itk.org/mailman/listinfo/insight-developers
>



More information about the Insight-developers mailing list