Use standard sort via zip instead of custom sort for multiple items#1106
Merged
riclarsson merged 1 commit intoatmtools:mainfrom Mar 9, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes several multi-array sorting sites by replacing the removed custom bubble_sort_by helper with std::ranges::sort over std::views::zip, keeping related containers permuted consistently while using standard library algorithms.
Changes:
- Replaced
bubble_sort_bycalls withstd::ranges::sort(std::views::zip(...), ...)in multiple call sites to sort multiple correlated sequences together. - Removed the unused
bubble_sort_byimplementation and related concepts fromsrc/core/util/sorting.h. - Updated includes/formatting where needed to support the new ranges-based sorting.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/workspace_meta_methods.cpp |
Sorts meta-method generic input vectors together via zipped ranges sort. |
src/python_interface/py_disort.cpp |
Sorts tau_ alongside an index vector using zipped ranges sort. |
src/m_lbl.cc |
Sorts equivalent value/string tensors together via zipped ranges sort. |
src/core/util/sorting.h |
Removes the custom bubble_sort_by utility (no remaining usages found). |
src/core/lbl/lbl_lineshape_voigt_nlte.cpp |
Sorts lines and pos together via zipped ranges sort. |
src/core/lbl/lbl_lineshape_voigt_lte_mirrored.cpp |
Same zipped sort refactor for mirrored LTE implementation (plus include tweak). |
src/core/lbl/lbl_lineshape_voigt_lte.cpp |
Same zipped sort refactor for LTE implementation. |
src/core/lbl/lbl_lineshape_voigt_ecs.cpp |
Replaces multi-vector bubble sort with zipped ranges sort for ECS pre-sorting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.