OK. As the question states I have an Inline Template method that returns an Iterator to a generic vector.
note: I know I should change the implementation to std::find, but that's not the problem I'm facing.
#include <vector>
template<typename T>
class List : public std::vector<T>
{
public:
List();
~List();
bool Contains(T object);
void Remove(const T& object);
private:
typedef typename std::vector<T>::iterator iterator;
typename std::vector<T>::iterator IteratorOf(const T& object);
};
template<typename T>
inline typename std::vector<T>::iterator List<T>::IteratorOf(const T&
object)
{
if (this->empty())
return nullptr;
else
{
for (typename std::vector<T*>::iterator iter = this->begin();
iter != this->end();
iter++)
{
if (*object == *iter)
return iter;
}
}
return nullptr;
}
This throws a myriad of compiler errors when I try and run it.
I seem to have tried everything however this method simply is not liked.
Beginning to wonder if there's a problem with returning generic iterators.