#include #include #include using namespace std; using namespace boost::intrusive; class ex : public std::exception { public: virtual const char * what() const throw() { return "diediedie"; } }; struct evil { set_member_hook<> hook; bool operator< (const evil& b) const { cout << __func__ << endl; throw ex(); } bool operator> (const evil& b) const { cout << __func__ << endl; throw ex(); } }; typedef multiset, &evil::hook> > mus; int main () { evil x, y; mus set; cout << set.size() << endl; set.insert(x); cout << set.size() << endl; try { set.insert(y); } catch(exception &e) { cout << e.what() << endl; } cout << set.size() << endl; for (mus::iterator i = set.begin(); i != set.end(); ++i) cout << '.'; cout << endl; } /*** OUTPUT: *** 0 1 operator< diediedie 2 . *** EXPECTED OUTPUT: 0 1 operator< diediedie 1 . ***************/