Hey all,
I ran into an interesting little problem with defining an iterator in a
custom array class the other day. It goes something like this:
template <typename T>
class Array
{
public:
typedef T * iterator;
iterator begin();
...
};
template <typename T>
Array<T>::iterator Array<T>::begin()
{...}
I thought that this would be enough to get it to compile, but it said that
Array<T>::iterator was an implicit typename declaration and that that was
deprecated. So, my question is, how can I make this work without adding
typename to the return type of every custom typedef in my class (without
actually writing the method inside the class definition, please). Also,
more importantly, I think, what exactly is the problem with doing what I do
in the code above? It seems like Array<T>::iterator is pretty explicit as
to what it's referring to.
James