Skip to content

Commit

Permalink
More compilation fixes for C++20: hvec_map and copy_bitref (#4703)
Browse files Browse the repository at this point in the history
* Fix another ambiguous equality.

* Add missing const qualifier.
  • Loading branch information
fruffy authored Jun 3, 2024
1 parent 1cbf44c commit 32f2c1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/bitvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,9 @@ class bitvec::copy_bitref : public bitvec::bitref<const bitvec> {
copy_bitref(const copy_bitref &a) = default;
copy_bitref(copy_bitref &&a) = default;
bool operator==(const bitref &a) const { return idx == a.idx && self == a.self; }
bool operator==(const copy_bitref &a) const { return idx == a.idx && self == a.self; }
bool operator!=(const bitref &a) const { return idx != a.idx || self != a.self; }
bool operator!=(const copy_bitref &a) const { return idx != a.idx || self != a.self; }
};
inline bitvec::copy_bitref bitvec::min() && { return copy_bitref(*this, ffs()); }
inline bitvec::copy_bitref bitvec::max() && { return --copy_bitref(*this, size * bits_per_unit); }
Expand Down
4 changes: 2 additions & 2 deletions lib/hvec_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ class hvec_map : hash_vector_base {
bool empty() const { return inuse == 0; }
size_t size() const { return inuse; }
size_t max_size() const { return UINT32_MAX; }
bool operator==(const hvec_map &a) {
bool operator==(const hvec_map &a) const {
if (inuse != a.inuse) return false;
auto it = begin();
for (auto &el : a)
if (el != *it++) return false;
return true;
}
bool operator!=(const hvec_map &a) { return !(*this == a); }
bool operator!=(const hvec_map &a) const { return !(*this == a); }
void clear() {
hash_vector_base::clear();
data.clear();
Expand Down

0 comments on commit 32f2c1d

Please sign in to comment.