From 6b0a2b81ca2b4054a0598514535780d04b39db5b Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Fri, 1 May 2020 21:34:42 +1000 Subject: Backport: Make lambdas noexcept. Backport of changeset 8222:b11c7c0d7978. --- src/Decoration.cxx | 8 ++++---- src/PerLine.cxx | 4 ++-- src/ViewStyle.cxx | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/Decoration.cxx b/src/Decoration.cxx index 9155a227e..94ec25463 100644 --- a/src/Decoration.cxx +++ b/src/Decoration.cxx @@ -148,7 +148,7 @@ Decoration *DecorationList::Create(int indicator, Sci::Position length typename std::vector>>::iterator it = std::lower_bound( decorationList.begin(), decorationList.end(), decoNew, - [](const std::unique_ptr> &a, const std::unique_ptr> &b) { + [](const std::unique_ptr> &a, const std::unique_ptr> &b) noexcept { return a->Indicator() < b->Indicator(); }); typename std::vector>>::iterator itAdded = @@ -162,7 +162,7 @@ Decoration *DecorationList::Create(int indicator, Sci::Position length template void DecorationList::Delete(int indicator) { decorationList.erase(std::remove_if(decorationList.begin(), decorationList.end(), - [indicator](const std::unique_ptr> &deco) { + [indicator](const std::unique_ptr> &deco) noexcept { return deco->Indicator() == indicator; }), decorationList.end()); current = nullptr; @@ -227,7 +227,7 @@ void DecorationList::DeleteRange(Sci::Position position, Sci::Position dele template void DecorationList::DeleteLexerDecorations() { decorationList.erase(std::remove_if(decorationList.begin(), decorationList.end(), - [](const std::unique_ptr> &deco) { + [](const std::unique_ptr> &deco) noexcept { return deco->Indicator() < INDICATOR_CONTAINER ; }), decorationList.end()); current = nullptr; @@ -240,7 +240,7 @@ void DecorationList::DeleteAnyEmpty() { decorationList.clear(); } else { decorationList.erase(std::remove_if(decorationList.begin(), decorationList.end(), - [](const std::unique_ptr> &deco) { + [](const std::unique_ptr> &deco) noexcept { return deco->Empty(); }), decorationList.end()); } diff --git a/src/PerLine.cxx b/src/PerLine.cxx index 085dccbaa..b729386a5 100644 --- a/src/PerLine.cxx +++ b/src/PerLine.cxx @@ -69,12 +69,12 @@ bool MarkerHandleSet::InsertHandle(int handle, int markerNum) { } void MarkerHandleSet::RemoveHandle(int handle) { - mhList.remove_if([handle](const MarkerHandleNumber &mhn) { return mhn.handle == handle; }); + mhList.remove_if([handle](const MarkerHandleNumber &mhn) noexcept { return mhn.handle == handle; }); } bool MarkerHandleSet::RemoveNumber(int markerNum, bool all) { bool performedDeletion = false; - mhList.remove_if([&](const MarkerHandleNumber &mhn) { + mhList.remove_if([&](const MarkerHandleNumber &mhn) noexcept { if ((all || !performedDeletion) && (mhn.number == markerNum)) { performedDeletion = true; return true; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 43b48544c..8be2bdf6a 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -309,10 +309,10 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) { } indicatorsDynamic = std::any_of(indicators.cbegin(), indicators.cend(), - [](const Indicator &indicator) { return indicator.IsDynamic(); }); + [](const Indicator &indicator) noexcept { return indicator.IsDynamic(); }); indicatorsSetFore = std::any_of(indicators.cbegin(), indicators.cend(), - [](const Indicator &indicator) { return indicator.OverridesTextFore(); }); + [](const Indicator &indicator) noexcept { return indicator.OverridesTextFore(); }); maxAscent = 1; maxDescent = 1; @@ -327,10 +327,10 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) { lineOverlap = lineHeight; someStylesProtected = std::any_of(styles.cbegin(), styles.cend(), - [](const Style &style) { return style.IsProtected(); }); + [](const Style &style) noexcept { return style.IsProtected(); }); someStylesForceCase = std::any_of(styles.cbegin(), styles.cend(), - [](const Style &style) { return style.caseForce != Style::caseMixed; }); + [](const Style &style) noexcept { return style.caseForce != Style::caseMixed; }); aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth; spaceWidth = styles[STYLE_DEFAULT].spaceWidth; -- cgit v1.2.3