Hi, it's my first post and question.
I have a template class that is going to be inherited by some other class. Within the parent class, I have a function:
Code:
template <class T>
T MyClass<T>::GetData ( int tag )
{
int index = GetIndex( tag );
if(index == NO_INDEX ) return NULL;
return VectorOfT.at(index);
}
Now, class T could be anything and specifically I want T to be <int> or
<MyCustomClass *>.
Now in the 5th line, it is checking for out of bounds error. The question is I do not know what to return if there is out of bounds. I have NULL for now, but if T is not a pointer, the program won't like it.