#include <cassert>
#include <iostream>
#include <map>
#include <algorithm>
#include <memory>
struct Test;
typedef std::shared_ptr<Test> TestPtr;
struct Test{
Test(int a, std::string b):a(a),b(b){}
int a;
std::string b;
};
int main()
{
std::map<int, TestPtr, std::greater<int>> cont;
TestPtr t1 = std::make_shared<Test>(1,"a");
TestPtr t2 = std::make_shared<Test>(2,"b");
TestPtr t3 = std::make_shared<Test>(3,"c");
TestPtr t4 = std::make_shared<Test>(4,"d");
cont = { { 1, t1 }, { 2, t2 }, { 3, t3 }, { 4, t4 } };
std::map<int,TestPtr, std::greater<int>>::iterator it;
it = find_if(cont.begin(),cont.end(),[](std::pair<int,TestPtr> it){ return it.first == 2;});
if (it != cont.end()) {
std::cout<<it->first<<","<<it->second<<std::endl;
}
}