Hi there again
This is my new problem:
I've this template:
template <class T> class TArray
{
T **m_array;
unsigned m_nSize;
public:
class iterator;
friend class iterator;
class iterator
{
const TArray& t;
unsigned index;
public:
iterator( const TArray<T>& a, unsigned s = 0 ): t(a), index(s) {}
const T* const operator++() { return t[++index]; }
const T* const operator++(int) { return t[index++]; }
const T* const operator*() const { return t[index]; };
bool operator==( const iterator& r ) const { return ( t==r.t )? 1 : 0; }
bool operator!=( const iterator& r ) const { return !operator==( r ); }
friend ostream operator << (ostream& os, const iterator& it);
};
TArray();
virtual ~TArray();
void Insert (T* t);
const T* const Max() const;
const iterator begin() const;
const iterator end() const;
};
Ye, ye... the definitions should be in diferent modules...
Anyway, when i do this in the main:
TArray<int> ar_int;
for ( unsigned i = 0; i < 10; i++ )
ar_int.Insert( new int(i) );
TArray<int>::iterator x(ar_int, 0); // this will point to the beggining
cout << *x << endl; // this should return the first value, the error is from here
It gives me this error:
'operator+' not implemented in type 'TArray<int>' for arguments of type 'unsigned int'
Why the 'operator+' is needed...???
Help here, guys...
Thanks in advance
