#include <iostream>
#include <vector>

class INT {
	int i;
public:
	INT(int ii) : i{ ii } {}
	operator int() { return i; }

	INT& operator++() { ++i; return *this; }
	INT operator++(int) { int temp = i; ++i; return temp; }   //is this the way to go?

	INT& operator--() { --i; return *this; }
	INT operator--(int) { int temp = i; --i; return temp; }   //is this the way to go?
};

template<typename Iter, typename Fct>
Fct for_each(Iter b, Iter e, Fct f)
{
    while(b != e) f(*b++);
    return f;
}

void increment(INT&i)
{
    ++i;
}

void display(INT i)
{
    std::cout << int(i) << ' ';
}

int main() {
	std::vector<INT> v = { 3, 4, 5 };
	
	for_each(v.begin(), v.end(), display);
	std::cout << '\n';
	
	for_each(v.begin(), v.end(), increment);

    for_each(v.begin(), v.end(), display);
}