From 6d504647c4974d8cf1968126af64e3f1a1b26ba0 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 4 Jun 2018 14:43:24 +1000 Subject: Backport: Use lambda in preference to function object. Backport of changeset 7019:6023ccf7f06c. --- lexers/LexCPP.cxx | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index eaf4900fe..f0fc01f7b 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -719,15 +719,6 @@ Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { return firstModification; } -// Functor used to truncate history -struct After { - Sci_Position line; - explicit After(Sci_Position line_) : line(line_) {} - bool operator()(const PPDefinition &p) const { - return p.line > line; - } -}; - void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); @@ -788,7 +779,8 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i if (!options.updatePreprocessor) ppDefineHistory.clear(); - std::vector::iterator itInvalid = std::find_if(ppDefineHistory.begin(), ppDefineHistory.end(), After(lineCurrent-1)); + std::vector::iterator itInvalid = std::find_if(ppDefineHistory.begin(), ppDefineHistory.end(), + [lineCurrent](const PPDefinition &p) { return p.line >= lineCurrent; }); if (itInvalid != ppDefineHistory.end()) { ppDefineHistory.erase(itInvalid, ppDefineHistory.end()); definitionsChanged = true; -- cgit v1.2.3