From 8f1ddf71a1f7df9a50129b9fad6391a34d7de99a Mon Sep 17 00:00:00 2001 From: Laurent Pugin Date: Wed, 13 Dec 2023 16:50:47 +0100 Subject: [PATCH] Adjust comments --- src/verticalaligner.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/verticalaligner.cpp b/src/verticalaligner.cpp index cb8214feec8..0bf5b3ed82e 100644 --- a/src/verticalaligner.cpp +++ b/src/verticalaligner.cpp @@ -98,6 +98,7 @@ void SystemAligner::ReorderBy(const std::vector &staffNs) std::sort(order.begin(), order.end()); order.erase(std::unique(order.begin(), order.end()), order.end()); // If not, we should return because the re-ordering below will corrupt the data + // Returning will keep the order as it is if (order.size() != staffNs.size()) return; ArrayOfObjects &children = this->GetChildrenForModification(); @@ -108,12 +109,13 @@ void SystemAligner::ReorderBy(const std::vector &staffNs) ListOfObjects orderedAlignments; for (auto staffN : staffNs) { StaffAlignment *alignment = this->GetStaffAlignmentForStaffN(staffN); - if (!alignment) return; // Something is wrong in the data, we keep the order as it is + if (!alignment) return; orderedAlignments.push_back(alignment); } int i = 0; - // We know that + // Since the number of staffAlignment is the same and they are unique, we can + // blindly replace them in the StaffAligner children for (auto alignment : orderedAlignments) { children.at(i) = alignment; ++i;