#include <algorithm>
#include <iostream>
#include <iomanip>
#include <memory>
#include <map>
#include <vector>
#include <utility>
#include <string>
#include <locale>
#include <list>
using namespace std;


int main(void)
{
#define DBG(x) cout << left << setw(30) << #x << boolalpha << (x) << endl;


	list<string> l = { "one", "two", "three", "four" };

	auto one_it = begin(l);

	l.emplace_front("zero"); // doesn't invalidate any iterators
	l.emplace_front("minus one");
	l.emplace_front("minus two");
	l.emplace_front("minus three");


	l.erase(one_it); // O(1)

	for(auto const& s : l) DBG(s);


	return 0;
}
