Also consider which displays all items of the map up to but not including the last element
Code:
#include <map>
#include <iterator>
#include <iostream>
using namespace std;

typedef map<int, int> M;

int main()
{
	M m { {1, 1}, {2, 2}, {3, 3} };

	const auto last = prev(m.end());

	for (auto it = m.begin(); it != last; ++it)
			cout << it->second << endl;
}