2 Attachment(s)
Using an template instance as a private member of a manged class. Is it possible?
I would like to use a template class instance as a private member of a Managed Class. Is it possible?
I´ve tried this on my managed class:
Code:
// PDAManager.h
#include "lista.h"
public __gc class PDAManager
{
private:
Lista <int> ListaDeInteiros;
I have an unmanaged code that implements the template
Code:
//lista.h
#pragma unmanaged
template <class Classe2>
class Lista
{
protected:
Celula<Classe2> sCabeca, sFinal, *pPonteiro;
int iTamanho;
public:
Celula<Classe2> *pPont, *pPont1, *pPont2, *pPont3;
Lista ();
//.Lista (Lista<Classe> &l);
//.~Lista ();
//...
}
template <class Classe2>
Lista<Classe2>::Lista()
{
sCabeca.suc = &sFinal;
sCabeca.ant = &sCabeca;
sFinal.suc = &sFinal;
sFinal.ant = &sCabeca;
pPonteiro = &sFinal;
iTamanho = 0;
}
I got this compiler error: Error C3633.
Quote:
Compiling...
PDAManager.cpp
c:\MyWorks\PDAManager.Net\PDAManager.h(72) : error C3633: cannot define 'ListaDeInteiros' as a member of managed 'IEAv::PDAManager'
because of the presence of default constructor 'Lista<Classe2>::Lista' on class 'Lista<Classe2>'
with
[
Classe2=int
]
and
[
Classe2=int
]
and
[
Classe2=int
]
c:\MyWorks\PDAManager.Net\PDAIncludes\LISTA.H(56) : see declaration of 'Lista<Classe2>::Lista'
with
[
Classe2=int
]
and
[
Classe2=int
]
What this Error C3633 means???
What is Interesting that if I take out the constructor and destructor of the template class, the error disapear...
I have attached the managed class and the templates classes that I am using. PDAManager.h has the Managed class that uses a template unmanaged class. Lista.h has the class that is an unmanaged template class.
Re: Using an template instance as a private member of a manged class. Is it possible?
What is interesting is that I can use templates on a implementation of an method on the managed class (PdaManager).
This code has compiled all right. No Problem at all!
See:
Code:
void PDAManager::teste(){
ConjuntoDePonteiros<Objeto> cnjRadar;
Radar* umRadar = new Radar();
cnjRadar.Inserir( umRadar );
}
Re: Using an template instance as a private member of a manged class. Is it possible?
I have simplified my code above, than you guys can understand easier.