#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <chrono>
#include <algorithm>

using Entry = std::tuple<std::string, int, int>;

int main(int argc, char** argv)
{
	const auto t_0 = std::chrono::high_resolution_clock::now();
	std::vector<Entry> v;
	v.reserve(argc * 1000 * 1000);
	for ( std::size_t i = 0; i < v.capacity(); ++i )
	{
		v.emplace_back(argv[0], 0, 0);
	}
	const auto t_1 = std::chrono::high_resolution_clock::now();
	std::vector<Entry*> pv;
	pv.reserve(argc * 1000 * 1000);
	for ( std::size_t i = 0; i < pv.capacity(); ++i )
	{
		pv.push_back(new std::tuple<std::string, int, int>(argv[0], 0, 0));
	}
	const auto t_2 = std::chrono::high_resolution_clock::now();
	auto rv = [&]()
	{
		std::sort(v.begin(), v.end(), [](const Entry& a, const Entry& b) { return a < b; });
		return std::get<1>(v.back());
	}();
	const auto t_3 = std::chrono::high_resolution_clock::now();
	auto rpv = [&]()
	{
		std::sort(pv.begin(), pv.end(), [](const Entry* a, const Entry* b) { return *a < *b; });
		return std::get<1>(*pv.back());
	}();
	const auto t_4 = std::chrono::high_resolution_clock::now();
	for ( auto& e : pv )
	{
		delete e;
	}
	const auto t_5 = std::chrono::high_resolution_clock::now();
	std::cout << (t_1 - t_0).count() << " for construction of v\n"
	          << (t_3 - t_2).count() << " for sorting v\n"
	          << (t_3 - t_2).count() + (t_1 - t_0).count() << " in total for v\n"
	          << (t_2 - t_1).count() << " for construction of pv\n"
	          << (t_4 - t_3).count() << " for sorting pv\n"
	          << (t_5 - t_4).count() << " for destruction of pv\n"
	          << (t_2 - t_1).count() + (t_4 - t_3).count() + (t_5 - t_4).count() << " in total for pv\n";
	return rpv - rv;
}