Skip to content

fix comparator for std::sort, follow strict weak ordering#112

Merged
mehermvr merged 1 commit intomainfrom
fix_sort_comparator
Apr 9, 2026
Merged

fix comparator for std::sort, follow strict weak ordering#112
mehermvr merged 1 commit intomainfrom
fix_sort_comparator

Conversation

@saurabh1002
Copy link
Copy Markdown
Collaborator

This pull request makes a small but important change to the sorting logic for closure candidates in the MapClosures::GetTopKClosures function. The comparison now uses strict greater-than (>) instead of greater-than-or-equal-to (>=), which ensures that closure candidates with the same number of inliers are not treated as interchangeable in the sort order. This avoids weird, once in a million issue with std::sort that core dumps life.

Copilot AI review requested due to automatic review settings April 9, 2026 13:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the closure-candidate sorting logic in MapClosures::GetTopKClosures to ensure the std::sort comparator satisfies strict weak ordering, preventing undefined behavior during sorting.

Changes:

  • Replace >= with > in the closure-candidate comparator used by std::sort.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@mehermvr mehermvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mehermvr mehermvr merged commit c5b556b into main Apr 9, 2026
22 checks passed
@saurabh1002 saurabh1002 deleted the fix_sort_comparator branch April 9, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants