, , , std:: set .
, unordered_set. ( , ), shared_from_this() alexm. - .
-
, .
:
struct Raw_comp{
using is_transparent = std::true_type;
bool operator()(const shared_ptr<MyObj>& lhs, const shared_ptr<MyObj>& rhs) const{
return lhs < rhs;
}
bool operator()(shared_ptr<MyObj>& lhs, MyObj* rhs) const{
return std::less<MyObj>()(lhs.get(), rhs);
}
bool operator()(const MyObj* lhs, const shared_ptr<MyObj>& rhs) const{
return std::less<MyObj>()(lhs, rhs.get());
}
};
:
set< shared_ptr<myObj>, Raw_cmp> sets;
,