[Insight-developers] typename
chenting
chenting at graphics.cis.upenn.edu
Tue Sep 5 15:03:28 EDT 2000
I found that for my SGI machine the typename should also be added when
there is ::
another problem is that when I compling the file itkImageMomentsTest.o
I found that
1. the complier says the class itk::Image<unsigned short, 3U> has no
member SetSize, line 66
2. The compler no longer recognize the identifer cout and cerr in file
itkImageMomentsTest.cxx and itkImageMoments.txx
Bill Hoffman wrote:
> Hi all,
>
> The Microsoft compiler seems to be a bit lax on requiring the key word
> typename. However, the SGI and gcc are not. The basic rule to
> follow is this:
>
> If you have a template parameter or template derived parameter and
> you use :: on the type, then it needs typename.
>
> Here are some examples:
>
> template <class T, class TOutputImage>
> foo()
> {
> T a; // OK
> T::FooType b; // ERROR
> typename T::FooType; // OK
> T::Pointer p; // ERROR
> typename T::Pointer p; // OK
> typedef typename TOutputImage::ScalarValueType scalar; // OK
> typedef TOutputImage::ScalarValueType scalar; // ERROR
> }
>
> If the type is used more than once in a class, then a class scope
> typedef with the correct typename would be a good idea.
> (See itkMesh.h, you can see typename is only used with
> typedefs that have a :: in them.)
>
> -Bill
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
More information about the Insight-developers
mailing list