I have a TemplateArray and a CharArray class.
How do I make it so the templatearray’s assignment operator only copies in from the chararray class when the templatearray is of the same type (I.E. char) or similar type (I.E. unsigned char) to chararray?
TemplateArray and CharArray are functionally the same (except CharArray can handle NULL terminated strings).
For example:
template<typename TemplateItem>
TemplateList & TemplateList<TemplateItem>::operator=(const CharArray &ItemCopy)
{
//How do I only copy when TemplateList is of type char (or similar unsigned char)
//IE is same/similar to CharArray
//Both classes are functionally the same, except CharArray is chars only
}
It looks like you need a specialization of
TemplateList::operator=: