Advertisement
HICONT

TSet.h

Oct 6th, 2022 (edited)
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. #pragma once
  2. #include "Set.h"
  3. class TSet
  4. {
  5. private:
  6.     int u_size;
  7.     TBitField TB;
  8. public:
  9.     TSet(int _u_size = 0)
  10.     {
  11.         u_size = _u_size;
  12.         TB = TBitField(u_size);
  13.     }
  14.     TSet(const TSet& tmp)
  15.     {
  16.         u_size = tmp.u_size;
  17.         TB = tmp.TB;
  18.     }
  19.     TSet& operator=(TSet tmp)
  20.     {
  21.         if (u_size != tmp.u_size)
  22.         {
  23.             u_size = tmp.u_size;
  24.         }
  25.         TB = tmp.TB;
  26.         return(*this);
  27.     }
  28.     ~TSet()
  29.     {
  30.  
  31.     }
  32.     void Add(int k)
  33.     {
  34.         TB.Add(k, u_size);
  35.     }
  36.     void del(int k)
  37.     {
  38.         TB.del(k, u_size);
  39.     }
  40.     string TSet_to_String()
  41.     {
  42.         return TB.TBitField_to_String(u_size);
  43.     }
  44.     TSet operator&(TSet tmp)
  45.     {
  46.         TSet res;
  47.         if (u_size == tmp.u_size)
  48.         {
  49.             res = TSet(*this);
  50.             res.TB = TB & tmp.TB;
  51.         }
  52.         return res;
  53.     }
  54.     TSet operator|(TSet tmp)
  55.     {
  56.         TSet res;
  57.         if (u_size == tmp.u_size)
  58.         {
  59.             res = TSet(*this);
  60.             res.TB = TB | tmp.TB;
  61.         }
  62.         return res;
  63.     }
  64.     TSet operator~()
  65.     {
  66.         TSet res(*this);
  67.         res.TB = ~TB;
  68.         return res;
  69.     }
  70. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement