|
|
@@ -355,8 +355,12 @@ class Tree::PostorderIterator
|
|
|
auto operator==(const PostorderIterator& rhs) const -> bool {
|
|
|
return node_ == rhs.node_;
|
|
|
}
|
|
|
- auto operator<(const PostorderIterator& rhs) const -> bool {
|
|
|
- return node_.index < rhs.node_.index;
|
|
|
+ // While we don't want users to directly leverage the index of `NodeId` for
|
|
|
+ // ordering, when we're explicitly walking in postorder, that becomes
|
|
|
+ // reasonable so add the ordering here and reach down for the index
|
|
|
+ // explicitly.
|
|
|
+ auto operator<=>(const PostorderIterator& rhs) const -> std::strong_ordering {
|
|
|
+ return node_.index <=> rhs.node_.index;
|
|
|
}
|
|
|
|
|
|
auto operator*() const -> NodeId { return node_; }
|