Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add iterator traits to bitref #3239

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/bitvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ class bitvec {
bool rv = self.getbit(idx);
b ? self.setbit(idx) : self.clrbit(idx);
return rv; }
using difference_type = std::ptrdiff_t;
using value_type = const bitvec;
using pointer = const bitvec*;
using reference = const bool&;
using iterator_category = std::bidirectional_iterator_tag;
};
typedef nonconst_bitref iterator;

Expand All @@ -140,6 +145,11 @@ class bitvec {
const_bitref(const bitref<const bitvec &> &a) : bitref(a) {} // NOLINT(runtime/explicit)
const_bitref(const const_bitref &a) = default;
const_bitref(const_bitref &&a) = default;
using difference_type = std::ptrdiff_t;
using value_type = const bitvec;
using pointer = const bitvec*;
using reference = const bool&;
using iterator_category = std::bidirectional_iterator_tag;
};
typedef const_bitref const_iterator;

Expand Down