I have std::set of shared pointers to objects of some type ( ints here are just for example ). What I need is to insert shared ptr's constructed from raw pointers. But when I'm trying to erase some of set elements ( again I have just a raw pointer ), I should construct shared_ptr and pass it to erase method ( it seems to me to be true because shared_ptr's comparison operators compare their raw pointers inside ) .
Code snippet, leading to SIGABRT:
std::set<std::shared_ptr<int>> sett;
int *rp = new int(5);
sett.emplace( rp );
sett.erase( std::shared_ptr<int>( rp ) );