// Set implementation // Matt Perry (mjperry2@uiuc.edu) #ifndef _SET_H #define _SET_H #include #include #include #include "element.h" using namespace std; class Set { private: vector elements; public: typedef vector::iterator iterator; typedef vector::const_iterator const_iterator; Set(); Set(const Set& s); iterator begin(); const_iterator begin() const; iterator end(); const_iterator end() const; void erase(iterator it); void clear(); int size() const; void insert(const Element& e); bool contains(const Element& e) const; const Element& operator[](int n) const; Set& operator=(const Set& b); }; Set set_union(const Set& a, const Set& b); Set set_intersection(const Set& a, const Set& b); Set set_difference(const Set& a, const Set& b); Set set_symmetric_difference(const Set& a, const Set& b); Set set_powerset(const Set& s); int test_subset(const Set& a, const Set& b); int test_proper_subset(const Set& a, const Set& b); int test_equal(const Set& a, const Set& b); int test_in_set(const Element& e, const Set& s); ostream& operator<<(ostream& os, const Set& s); #endif // set.h