From b7982c6ee38246019996e96ae7f3b4527fa50c1d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 7 Jun 2017 13:36:47 +0100 Subject: [PATCH] Use range based accumulate wrapper instead of std::accumulate --- src/insert_completer.cc | 6 +++--- src/shared_string.cc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/insert_completer.cc b/src/insert_completer.cc index d54b85e3..c2659579 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -159,9 +159,9 @@ InsertCompletion complete_word(const SelectionList& sels, const OptionManager& o std::sort(matches.begin(), matches.end()); matches.erase(std::unique(matches.begin(), matches.end()), matches.end()); - const auto longest = std::accumulate(matches.begin(), matches.end(), 0_char, - [](const CharCount& lhs, const RankedMatchAndBuffer& rhs) - { return std::max(lhs, rhs.candidate().char_length()); }); + const auto longest = accumulate(matches, 0_char, + [](const CharCount& lhs, const RankedMatchAndBuffer& rhs) + { return std::max(lhs, rhs.candidate().char_length()); }); InsertCompletion::CandidateList candidates; candidates.reserve(matches.size()); diff --git a/src/shared_string.cc b/src/shared_string.cc index eb12ca27..74c6c106 100644 --- a/src/shared_string.cc +++ b/src/shared_string.cc @@ -6,9 +6,9 @@ namespace Kakoune StringDataPtr StringData::create(ArrayView strs) { - const int len = std::accumulate(strs.begin(), strs.end(), 0, - [](int l, StringView s) - { return l + (int)s.length(); }); + const int len = accumulate(strs, 0, [](int l, StringView s) { + return l + (int)s.length(); + }); void* ptr = StringData::operator new(sizeof(StringData) + len + 1); auto* res = new (ptr) StringData(len); auto* data = reinterpret_cast(res + 1);