Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / Unrecognizable template definitions... Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
James Bellinger

May 21, 2005, 04:42 PM

Any idea what about this

  1.  
  2. template <class OtherType> const typename Base::Operations::Multiply<OtherType>::Type operator *
  3.   (const OtherType& other) const
  4.  


would be unrecognizable by Visual C++? (also, a syntax error '
  1.  
  2. template <class StorageType> class Base: public StorageType
  3.  


the storage type being used,

  1.  
  2. template <size_t Rows, size_t Cols, typename Type, class Parent> class StaticStorage: public Parent
  3.  


and where Operations is actually coming from (it fills in as Parent for that),

  1.  
  2. template <size_t Rows, size_t Cols, typename Type> class TypeProvider<Math::Matrix<Rows, Cols, Type> >
  3. {
  4.   protected:
  5.   ...
  6.   struct Operations
  7.   {
  8.     ...
  9.     template <class OtherType> struct Multiply
  10.       { typedef Math::BigMatrix<Type> Type; };
  11.  
  12.     template <size_t OtherCols> struct Multiply<Math::Matrix<Rows, OtherCols, Type> >
  13.       { typedef Math::Matrix<Rows, OtherCols, Type> Type; };
  14.     ...
  15.   };
  16.   ...
  17. };
  18.  


It seems like it should work fine to me. Any idea why it's erroring out on that Base::Operations::Multiply::Type bit?

Thanks in advance,
Jim Bellinger

Ah, forgot to mention. If Math::Matrix makes any difference it's the child class a few down the hierarchy from Base, and that TypeProvider is a specialization of template class TypeProvider.

 
Mattias Jansson

May 21, 2005, 05:09 PM

In Operations:

  1. typedef typename Math::BigMatrix<Type> Type;
  2. typedef typename Math::Matrix<Rows, OtherCols, Type> Type;
  3. //And so on and so forth


... to give the compiler some help :)

 
James Bellinger

May 21, 2005, 06:07 PM

Thanks, doing a typedef typename Base::Operations OpTypes; did the trick.

Is there some part of the C++ standard that necessited that (is that necessary on all compilers or just VC++, in other words)?

 
I'M BRIAN FELLOWS

May 21, 2005, 08:19 PM

THAT CODE IS CRAZY.

 
juhnu

May 22, 2005, 12:31 AM

indeed

 
Chris

May 22, 2005, 03:59 AM

The standard requires it, it's VC++ that didn't recognize it in the past.

 
This thread contains 6 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.