|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi
can any one provide solution for it Thanks Pallav --------------------------------------------------------------------------------------------------------------------------- template<typename T> class BXT { public: typedef T Mystery; template<typename U> struct Magic; }; template<typename T> class DXTT : private BXT<T> { public: typename BXT<T>::Mystery * p; template BXT<T>::template Magic<U> * plink; // I am getting at this Line // can anyone suggest Soltuion for it }; |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Pallav singh wrote:
> Hi > > can any one provide solution for it > > Thanks > Pallav > > --------------------------------------------------------------------------------------------------------------------------- > > template<typename T> > class BXT { > public: > typedef T Mystery; > template<typename U> > struct Magic; > }; > > template<typename T> > class DXTT : private BXT<T> { > public: > > typename BXT<T>::Mystery * p; OK, this defines 'p' as a pointer to a BXT<T>::Mystery object. > template BXT<T>::template Magic<U> * plink; There is no 'U' in the context of this (DXTT) class. What is 'plink' supposed to be? A pointer to what? Since the type 'BXT<T>::Magic' is not really a type, but a *template*, you cannot declare a pointer to it. You have to instantiate it first. In your case 'Magic' needs the list of arguments, and it should have only one element. What is it supposed to be? If the argument for 'Magic' is, for instance, 'int', then the declaration of 'plink' would be typename BXT<T>::Magic<int> * plink; But you have given _no_ indication what you want to use as the argument for 'Magic' template. Perhaps your 'DXTT' template needs to have two arguments, 'T' and 'U'? > // I am getting at this Line > // can anyone suggest Soltuion for it > > }; V -- Please remove capital 'A's when replying by e-mail I do not respond to top-posted replies, please don't ask |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Pallav singh wrote:
> > template<typename T> > class BXT { > public: > typedef T Mystery; > template<typename U> > struct Magic; > }; > > template<typename T> > class DXTT : private BXT<T> { > public: > typename BXT<T>::Mystery * p; > template BXT<T>::template Magic<U> * plink; Firstly, as Victor said already, there's no 'U' in this context. Secondly, it is supposed to be typename BXT<T>::template Magic<...whatever...>* plink; ^^^^^^^^ Note the first keyword: 'typename', not 'template'. -- Best regards, Andrey Tarasevich |
|
![]() |
| Outils de la discussion | |
|
|