| 38 | { |
| 39 | public: |
| 40 | class proxy |
| 41 | { |
| 42 | friend bitset8; |
| 43 | |
| 44 | public: |
| 45 | constexpr20 ~proxy() noexcept {} |
| 46 | |
| 47 | constexpr14 proxy& operator=(bool Value) noexcept { |
| 48 | ref->set(pos, Value); |
| 49 | return *this; |
| 50 | } |
| 51 | |
| 52 | constexpr14 proxy& operator=(const proxy& p) noexcept { |
| 53 | ref->set(pos, static_cast<bool>(p)); |
| 54 | return *this; |
| 55 | } |
| 56 | |
| 57 | constexpr14 operator bool() const noexcept { |
| 58 | return ref->test(pos); |
| 59 | } |
| 60 | |
| 61 | private: |
| 62 | constexpr14 proxy(bitset8* _ref, size_t _pos) : ref(_ref), pos(_pos) {} |
| 63 | |
| 64 | bitset8* const ref; |
| 65 | size_t const pos; |
| 66 | }; |
| 67 | |
| 68 | constexpr14 bitset8() : stored(0) {} |
| 69 | constexpr14 bitset8(uint8_t val) : stored(val) {} |