Hey when I don't template my classes, I can pass member functions to eachother normally. But when I template it, I get errors. The two functions are defined as so:
CustomType& Delete(int Position);
CustomType& Delete(T ValueToDelete, bool All = false);
CustomType& Delete(CustomType ValuesToDelete);
And Implemented like this:
template<typename T>
CustomType<T>& CustomType<T>::Delete(T ValueToDelete, bool All)
{
for (size_t I = 0; I < TypeData.size(); I++)
if (TypeData[I] == ValueToDelete)
{
TypeData.erase(TypeData.begin() + I);
if (!All)
break;
I = 0;
}
return *this;
}
template<typename T>
CustomType<T>& CustomType<T>::Delete(CustomType ValuesToDelete)
{
for (size_t I = 0; I < ValuesToDelete.size(); I++)
{
this->Delete(ValuesToDelete[I], true); //The error below points to this line.
}
return *this;
}
Used like:
int main()
{
CustomType<int> CT(1, 5, 4, 7, 9, 14, 23, 89);
CT.Delete(CT); //FAILS!
}
//error: no matching function for call to 'CustomType<int>::Delete(CustomType<int>&, bool)'
When my classes aren't templated, these functions work perfectly fine. I do not understand why it doesn't work now :S Any help is appreciated.