// Author: A.Voss@FH-Aachen.de

#include <iostream>
#include <cstdlib>
#include <memory>
#include <cstdlib>
#include <vector>
#include <chrono>
using namespace std;

class C {
	public:		
		int n;
		
		C(int m=0) : n(m) {
			//cout << "C() n=" << n << endl;
		}
		
		~C() {
			//cout << "~C() n=" << n << endl;
		}
};

int main()
{
    cout << "start" << endl;
 
	srand(0);
	vector<C*> v;
	const int len = 10000;
	const int rep = 10000;
	
    auto begin = chrono::high_resolution_clock::now();    

	for (int j=0; j<rep; ++j)
	{
		for (int i=0; i<len; ++i) {
			v.push_back(new C(rand() % len));
		}
		while (v.size()>0) {
			delete v[v.size()-1];
			v.erase(--v.end());
		}
	}
    auto end = chrono::high_resolution_clock::now();    
    auto dur = end - begin;
    auto ms = chrono::duration_cast<std::chrono::milliseconds>(dur).count();
    cout << "ms = " << ms << endl;
 
    cout << "end" << endl;
        
    return EXIT_SUCCESS;
}

