// throws exception if both objects do not refer to the same isbn Sales_item operator+(const Sales_item& lhs, const Sales_item& rhs) { if (!lhs.same_isbn(rhs)) throw isbn_mismatch("isbn mismatch", lhs.book(), rhs.book()); Sales_item ret(lhs); // copy lhs into a local object that we'll return ret += rhs; // add in the contents of rhs return ret; // return ret by value }
bool compare ( const Sales_item& i, const Sales_item& j ) { return i->book() < j->book(); }
//compare function of Sales_Item for multiset to use inline bool compare(const Sales_item& rh1,const Sales_item& rh2) { return rh1->book() < rh2->book() ; }