Use range based accumulate wrapper instead of std::accumulate
This commit is contained in:
parent
a0d848da8d
commit
b7982c6ee3
|
@ -159,9 +159,9 @@ InsertCompletion complete_word(const SelectionList& sels, const OptionManager& o
|
||||||
std::sort(matches.begin(), matches.end());
|
std::sort(matches.begin(), matches.end());
|
||||||
matches.erase(std::unique(matches.begin(), matches.end()), matches.end());
|
matches.erase(std::unique(matches.begin(), matches.end()), matches.end());
|
||||||
|
|
||||||
const auto longest = std::accumulate(matches.begin(), matches.end(), 0_char,
|
const auto longest = accumulate(matches, 0_char,
|
||||||
[](const CharCount& lhs, const RankedMatchAndBuffer& rhs)
|
[](const CharCount& lhs, const RankedMatchAndBuffer& rhs)
|
||||||
{ return std::max(lhs, rhs.candidate().char_length()); });
|
{ return std::max(lhs, rhs.candidate().char_length()); });
|
||||||
|
|
||||||
InsertCompletion::CandidateList candidates;
|
InsertCompletion::CandidateList candidates;
|
||||||
candidates.reserve(matches.size());
|
candidates.reserve(matches.size());
|
||||||
|
|
|
@ -6,9 +6,9 @@ namespace Kakoune
|
||||||
|
|
||||||
StringDataPtr StringData::create(ArrayView<const StringView> strs)
|
StringDataPtr StringData::create(ArrayView<const StringView> strs)
|
||||||
{
|
{
|
||||||
const int len = std::accumulate(strs.begin(), strs.end(), 0,
|
const int len = accumulate(strs, 0, [](int l, StringView s) {
|
||||||
[](int l, StringView s)
|
return l + (int)s.length();
|
||||||
{ return l + (int)s.length(); });
|
});
|
||||||
void* ptr = StringData::operator new(sizeof(StringData) + len + 1);
|
void* ptr = StringData::operator new(sizeof(StringData) + len + 1);
|
||||||
auto* res = new (ptr) StringData(len);
|
auto* res = new (ptr) StringData(len);
|
||||||
auto* data = reinterpret_cast<char*>(res + 1);
|
auto* data = reinterpret_cast<char*>(res + 1);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user