I don't know whats making this code give an error. It's a simple multiset. No compilation errors, but segmentation fault on the machine while executing.
g++ version : 4.8.2
Machine : Ubuntu 14.04
#include <cstdio>
#include <set>
using namespace std;
struct compare
{
    bool operator() (int lhs, int rhs) { return lhs < rhs; }
};
typedef multiset < int, compare >  mi;
mi sett;
int main(void)
{
    sett.insert(5);
    sett.insert(5);
    sett.erase(*sett.begin());
    sett.erase(*sett.rbegin());
    printf("Done\n");
}
				
                        
Your first
eraseeffectively emptied yourmultiset.From
std::multiset::erase(emphasis mine)Therefore the second time you are trying to
eraseyou are trying to dereferencestd::multiset::end, which is what is returned bysett.rbegin()for the emptymultiset