Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "Set.h"
- class TSet
- {
- private:
- int u_size;
- TBitField TB;
- public:
- TSet(int _u_size = 0)
- {
- u_size = _u_size;
- TB = TBitField(u_size);
- }
- TSet(const TSet& tmp)
- {
- u_size = tmp.u_size;
- TB = tmp.TB;
- }
- TSet& operator=(TSet tmp)
- {
- if (u_size != tmp.u_size)
- {
- u_size = tmp.u_size;
- }
- TB = tmp.TB;
- return(*this);
- }
- ~TSet()
- {
- }
- void Add(int k)
- {
- TB.Add(k, u_size);
- }
- void del(int k)
- {
- TB.del(k, u_size);
- }
- string TSet_to_String()
- {
- return TB.TBitField_to_String(u_size);
- }
- TSet operator&(TSet tmp)
- {
- TSet res;
- if (u_size == tmp.u_size)
- {
- res = TSet(*this);
- res.TB = TB & tmp.TB;
- }
- return res;
- }
- TSet operator|(TSet tmp)
- {
- TSet res;
- if (u_size == tmp.u_size)
- {
- res = TSet(*this);
- res.TB = TB | tmp.TB;
- }
- return res;
- }
- TSet operator~()
- {
- TSet res(*this);
- res.TB = ~TB;
- return res;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement