diff options
author | Alon Zakai <azakai@google.com> | 2022-04-25 13:20:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-25 13:20:27 -0700 |
commit | 23a1a79603d5d102b82558c7822eaa1bbed16fd2 (patch) | |
tree | 01e40cf7cd7b9b22d3a118bd18e3878c90f29448 /src/support/small_set.h | |
parent | 94d77efa788b46ec3d245fd0e180163877fe2a88 (diff) | |
download | binaryen-23a1a79603d5d102b82558c7822eaa1bbed16fd2.tar.gz binaryen-23a1a79603d5d102b82558c7822eaa1bbed16fd2.tar.bz2 binaryen-23a1a79603d5d102b82558c7822eaa1bbed16fd2.zip |
SmallSet: Mark iterator parent as const (#4613)
We already assume the parent does not change,
binaryen/src/support/small_set.h
Lines 202 to 208 in 94d77ef
// std::set allows changes while iterating. For us here, though, it would
// be nontrivial to support that given we have two iterators that we
// generalize over (switching "in the middle" would not be easy or fast),
// so error on that.
if (usingFixed != other.usingFixed) {
Fatal() << "SmallSet does not support changes while iterating";
}
This also marks the parent as const to reflect that.
This fixed a weird C++ compilation error I had when working on
something unrelated, but seems worth landing independently.
Diffstat (limited to 'src/support/small_set.h')
-rw-r--r-- | src/support/small_set.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/support/small_set.h b/src/support/small_set.h index 9ee0f0403..f8725ec9d 100644 --- a/src/support/small_set.h +++ b/src/support/small_set.h @@ -165,7 +165,7 @@ public: using pointer = const value_type*; using reference = const value_type&; - Parent* parent; + const Parent* parent; using Iterator = IteratorBase<Parent, FlexibleIterator>; @@ -176,7 +176,7 @@ public: size_t fixedIndex; FlexibleIterator flexibleIterator; - IteratorBase(Parent* parent) + IteratorBase(const Parent* parent) : parent(parent), usingFixed(parent->usingFixed()) {} void setBegin() { |