Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class IntegralT = std::uint32_t>
- class BitSet {
- public:
- BitSet();
- BitSet(const int size, const bool v = false);
- class BitHolder {
- public:
- BitHolder& operator=(bool v);
- operator bool() const;
- private:
- BitHolder(IntegralT *ptr, unsigned int pos);
- friend class BitSet<IntegralT>;
- IntegralT *ptr{ nullptr };
- unsigned int pos{ 0 };
- };
- bool operator[](const int index) const;
- BitHolder operator[](const int index);
- void resize(const int size);
- int size() const;
- // bool operator==(const BitSet<T> &rhs) const;
- // bool operator!=(const BitSet<T> &rhs) const;
- // BitSet<T>& operator<<=(const int shift);
- // BitSet<T>& operator>>=(const int shift);
- // BitSet<T>& operator&=(const BitSet<T> &rhs);
- // BitSet<T>& operator|=(const BitSet<T> &rhs);
- // BitSet<T>& operator^=(const BitSet<T> &rhs);
- // BitSet<T> operator~() const;
- // BitSet<T> operator<<(const int shift);
- // BitSet<T> operator>>(const int shift);
- // BitSet<T> operator&(const BitSet<T> &rhs);
- // BitSet<T> operator|(const BitSet<T> &rhs);
- // BitSet<T> operator^(const BitSet<T> &rhs);
- private:
- std::vector<IntegralT> data_{};
- int size_{ 0 };
- static constexpr int integral_type_size_ = sizeof(IntegralT);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement