Make KeyAddrBitfield class const-correct

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1121/head
Michael Richters 3 years ago
parent d898725725
commit 8aa9206a08
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -109,16 +109,16 @@ class KeyAddrBitfield {
class Iterator; class Iterator;
friend class KeyAddrBitfield::Iterator; friend class KeyAddrBitfield::Iterator;
Iterator begin() { Iterator begin() const {
return Iterator{*this, 0}; return Iterator{*this, 0};
} }
Iterator end() { Iterator end() const {
return Iterator{*this, total_blocks}; return Iterator{*this, total_blocks};
} }
class Iterator { class Iterator {
public: public:
Iterator(KeyAddrBitfield &bitfield, uint8_t x) Iterator(const KeyAddrBitfield &bitfield, uint8_t x)
: bitfield_(bitfield), block_index_(x) {} : bitfield_(bitfield), block_index_(x) {}
bool operator!=(const Iterator &other) { bool operator!=(const Iterator &other) {
@ -163,7 +163,7 @@ class KeyAddrBitfield {
} }
private: private:
KeyAddrBitfield &bitfield_; const KeyAddrBitfield &bitfield_;
uint8_t block_index_; // index of the block uint8_t block_index_; // index of the block
uint8_t bit_index_{0}; // bit index in the block uint8_t bit_index_{0}; // bit index in the block
uint8_t block_; uint8_t block_;

Loading…
Cancel
Save