#ifndef SETH #define SETH #include #include #include using namespace std; //T must be copy constructable (line 31) and equality comparable (line 17). template class set { vector v; public: bool find(const T& t) const { for (typename vector::const_iterator it = v.begin(); it != v.end(); ++it) { if (*it == t) { return true; } } return false; } void insert(const T& t) { if (find(t)) { cerr << "Sorry, the value is already in the set.\n"; exit(EXIT_FAILURE); } v.push_back(t); } }; #endif