I keep getting "None of the 6 overloads could convert all arguments". I only get this problem in visual studio though. When I compile with g++ or codeblocks, it works perfectly fine.
The code I'm calling my templates with is: MemDeSerialize(ListOfItems, SerializedData, size_t(Data[2]));
The definitions:
template<typename T>
void MemDeSerialize(T& Destination, unsigned char* &Source){...}
template<typename T>
void MemDeSerialize(T*& Destination, unsigned char* &Source, size_t Size){...}
template<typename T>
void MemDeSerialize(std::vector<T> &Destination, unsigned char* &Source, size_t Size)
{
Destination.resize(Size);
for (size_t I = 0; I < Size; ++I)
MemDeSerialize(&Destination[I], Source, Size);
}
/** FUNCTION OVERLOADS **/
void MemDeSerialize(Model* Destination, unsigned char* &Source);
void MemDeSerialize(PanelItem* Destination, unsigned char* &Source);
void MemDeSerialize(Compass* Destination, unsigned char* &Source);
void MemDeSerialize(FontChar* Destination, unsigned char* &Source);
The Error I get is:
1>error C2665: 'MemDeSerialize' : none of the 6 overloads could convert all the argument types
1>could be 'void MemDeSerialize<PanelItem>(T *&,unsigned char *&,size_t)'
1> with
1> [
1> T=PanelItem
1> ]
1> while trying to match the argument list '(PanelItem *, unsigned char *, size_t)'
1> see reference to function template instantiation 'void MemDeSerialize<PanelItem>(std::vector<_Ty> &,unsigned char *&,size_t)' being compiled
1> with
1> [
1> _Ty=PanelItem
1> ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any idea why it's doing that in visual studio but not g++?