#define OLC_PGE_APPLICATION #include "pixelGameEngine.h" #include using namespace olc; struct myStruct{ std::string name=""; int level=1; }; std::vector> vals; void AddVal(std::weak_ptrnewVal) { auto findVal=std::find_if(vals.begin(),vals.end(), [&newVal](std::weak_ptr&val) { return val.lock()->name==newVal.lock()->name; } ); if (findVal!=vals.end()) { std::cout<<"Value "<name<<" already exists."<lock()->level++; std::cout<lock()->name+" is now level "<lock()->level<name<<" does not exist."<name+" is now level "<level< myPtr1=std::make_shared(); std::shared_ptr myPtr2=std::make_shared(); std::shared_ptr myPtr3=std::make_shared(); std::shared_ptr myPtr4=std::make_shared(); std::weak_ptr refPtr1=myPtr1; std::weak_ptr refPtr2=myPtr2; std::weak_ptr refPtr3=myPtr3; std::weak_ptr refPtr4=myPtr2; refPtr1.lock()->name="Test Upgrade 1"; refPtr2.lock()->name="Test Upgrade 2"; refPtr3.lock()->name="Test Upgrade 3"; std::cout<<(refPtr2.lock()==refPtr4.lock())<