Add equality comparisons to Ptr (#774)

This commit is contained in:
Geoff Romer
2021-08-30 11:27:52 -07:00
committed by GitHub
parent fe28dd9a33
commit 0ac220b30f
2 changed files with 4 additions and 2 deletions
+3
View File
@@ -32,6 +32,9 @@ class Ptr {
T* Get() const { return ptr; }
friend auto operator==(Ptr lhs, Ptr rhs) { return lhs.ptr == rhs.ptr; }
friend auto operator!=(Ptr lhs, Ptr rhs) { return lhs.ptr != rhs.ptr; }
private:
T* ptr;
};
@@ -1139,8 +1139,7 @@ struct DoTransition {
void operator()(const UnwindTo& unwind_to) {
Ptr<Frame> frame = state->stack.Top();
// TODO: drop .Get() calls once `Ptr` has comparison operators
while (frame->todo.Top().Get() != unwind_to.new_top.Get()) {
while (frame->todo.Top() != unwind_to.new_top) {
if (IsBlockAct(frame->todo.Top())) {
DeallocateScope(frame->scopes.Top());
frame->scopes.Pop();