Lines 27, 29, 31, 33: This technique of implementing operator++(int) and operator--(int) is wrong. These operators return the previous value of the object, which you can accomplish along these lines:
Iterator operator++(int) { //Note: Iterator, not Iterator&
Iterator ret = *this; // Save a copy of *this
++elem;
return ret; // Return the saved copy
}
The error message you cite refers to line 287. Which line is that in what you posted?