//template<typename T>
class MyReg{
public:
...
typedef itk::Image< PixelType, Dimension > FixedImageType;
typedef itk::Image< PixelType, Dimension > MovingImageType;
typedef itk::ImageFileReader< FixedImageType > FixedImageReaderType;
typedef itk::ImageFileReader< MovingImageType > MovingImageReaderType;
MyReg(MyParameters param, FixedImageReaderType::Pointer fixed,
MovingImageReaderType::Pointer moving){
this->param = param;
this->fixedImageReader = fixed;
this->movingImageReader = moving;
}
};
This compiles fine. But if I use the template declaration:
template<typename T>
class MyReg{
public:
...
...
I get the compiler error:
Error 2 error C2061: syntax error : identifier 'Pointer'
I have found that a fix is to add typename to the arguments in the
constructor:
MyReg(MyParameters param, typename FixedImageReaderType::Pointer fixed,
typename MovingImageReaderType::Pointer moving){
But why does this solve the problem? I have read that when typename is used
its to tell the compiler that follwing code is a type, but would that not be
obvious in a constructor?