my compiler tormented me by this creation error, which I do not fully understand.
I have a listItem class class:
template <class T>
class tListItem{
public:
tListItem(T t){tData=t; next=0;}
tListItem *next;
T data(){return tData;}
private:
T tData;
};
if I try to initialize its object with a non-primitive data type, for example, for example:
sPacket zomg("whaever",1);
tListItem<sPacket> z(zomg);
my compiler always throws this error .. the error is not generated by primitive types.
compiler output:
../linkedList/tListItem.h: In constructor ‘tListItem<T>::tListItem(T) [with T = sPacket]’:
recvBufTest.cpp:15: instantiated from here
../linkedList/tListItem.h:4: error: no matching function for call to ‘sPacket::sPacket()’
../packetz/sPacket.h:2: note: candidates are: sPacket::sPacket(const char*, int)
../packetz/sPacket.h:1: note: sPacket::sPacket(const sPacket&)
I would not bother you, but I do not want to spend 2 hours on something stupid ..... so for all your answers
source
share