G
Gerhard Pfeiffer
Hi,
I'm trying to implement a data-structure and have an iterator for it. Now I've
got a problem impleneting the operator+. I tried to isolate the problem:
template<int DIM, typename T> class data_structure {
private:
int data[256];
public:
class iterator {
public:
int index;
};
};
template<int DIM, typename T>
data_structure<DIM, T>::iterator
operator+(data_structure<DIM, T>::iterator it, int n) {
iterator ret();
ret.index = it.index + n;
}
and g++ gives me this error:
bla.cpp:13: error: expected constructor, destructor, or type conversion before
'operator'
I just don't see, what I'm doing wrong here. Any hints would be appreciated.
Ciao,
Gerhard
I'm trying to implement a data-structure and have an iterator for it. Now I've
got a problem impleneting the operator+. I tried to isolate the problem:
template<int DIM, typename T> class data_structure {
private:
int data[256];
public:
class iterator {
public:
int index;
};
};
template<int DIM, typename T>
data_structure<DIM, T>::iterator
operator+(data_structure<DIM, T>::iterator it, int n) {
iterator ret();
ret.index = it.index + n;
}
and g++ gives me this error:
bla.cpp:13: error: expected constructor, destructor, or type conversion before
'operator'
I just don't see, what I'm doing wrong here. Any hints would be appreciated.
Ciao,
Gerhard