Ich skizziere die Situation:
|
Quellcode
|
1
2
3
4
5
6
7
8
|
template <typename TType,typename TListElement=CListElement<TType> >
class CList
{
public:
inline CList(void);
inline CList(const CList<TType,TListElement>& ListObject);
inline ~CList(void);
};
|
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
|
template <typename TType,bool bAutoDelete=true,bool bAllowNullPointers=false>
class CPointerList: public CList<TType*,CListElementPointer<TType,bAutoDelete> >
{
public:
inline CPointerList(void);
//copy pointers if bAutoDelete==false,
//otherwise, copy objects
template <bool bAutoDeleteSource> inline CPointerList(const CPointerList<TType,bAutoDeleteSource,bAllowNullPointers>& PointerList);
inline ~CPointerList(void);
};
|
So. Soweit alles klar. Wenn ich aber jetzt PointerListen mit dem CopyKonstuktor erzeuge, ruft den Kopy-Konstruktor von CList auf! Das darf nicht sein. Warum macht er das?
|
Quellcode
|
1
2
3
|
CPointerList<int> PointerListInt;
PointerListInt.AddP(new int(0));
CPointerList<int> PointerListInt2(PointerListInt); //er ruft CList<int*>::CList(const CList<int*>& List auf!
|
Ich bin mir ziemlich sicher, dass die Implementierung (selbstverständlich im Header) nicht schuld ist.
Vielleicht kann mir ja jemand helfen.