#include <iostream>
using std::cout;
using std::endl;
class MyType {
public:
MyType (int arg = 0) : x(arg) {
}
bool operator!=(const MyType& arg) const {
cout << "comparing" << endl;
return x != arg.x;
}
int operator*() const { return x; }
MyType& operator++() {
++x;
return *this;
}
private:
int x;
};
int main() {
MyType begin(3);
MyType end(7);
for( ; begin != end ; ++begin)
cout << *begin << " ";
return 0;
}
|