Commit 4e9fd967 authored by Ingo Klöcker's avatar Ingo Klöcker Committed by Ingo Klöcker
Browse files

Make lambdas used in std::accumulate compatible with C++20

The first argument cannot be T& because the reference is removed when
the first argument that is passed to the binary operation is moved.
parent c5a44265
......@@ -154,7 +154,7 @@ void ExportGroupsCommand::Private::start()
const auto groupKeys = std::accumulate(std::begin(groups), std::end(groups),
KeyGroup::Keys{},
[](auto &allKeys, const auto &group) {
[](auto allKeys, const auto &group) {
const auto keys = group.keys();
allKeys.insert(std::begin(keys), std::end(keys));
return allKeys;
......
......@@ -652,13 +652,13 @@ void ImportCertificatesCommand::Private::keyCacheUpdated()
const auto allIds = std::accumulate(std::cbegin(results), std::cend(results),
std::set<QString>{},
[](auto &allIds, const auto &r) {
[](auto allIds, const auto &r) {
allIds.insert(r.id);
return allIds;
});
const auto canceledIds = std::accumulate(std::cbegin(results), std::cend(results),
std::set<QString>{},
[](auto &canceledIds, const auto &r) {
[](auto canceledIds, const auto &r) {
if (importWasCanceled(r)) {
canceledIds.insert(r.id);
}
......@@ -731,7 +731,7 @@ static auto accumulateNewKeys(std::vector<std::string> &fingerprints, const std:
{
return std::accumulate(std::begin(imports), std::end(imports),
fingerprints,
[](auto &fingerprints, const auto &import) {
[](auto fingerprints, const auto &import) {
if (import.status() == Import::NewKey) {
fingerprints.push_back(import.fingerprint());
}
......@@ -743,7 +743,7 @@ static auto accumulateNewOpenPGPKeys(const std::vector<ImportResultData> &result
{
return std::accumulate(std::begin(results), std::end(results),
std::vector<std::string>{},
[](auto &fingerprints, const auto &r) {
[](auto fingerprints, const auto &r) {
if (r.protocol == GpgME::OpenPGP) {
fingerprints = accumulateNewKeys(fingerprints, r.result.imports());
}
......
......@@ -633,7 +633,7 @@ QItemSelection itemSelectionFromKeys(const std::vector<Key> &keys, const QTreeVi
return std::accumulate(
indexes.cbegin(), indexes.cend(),
QItemSelection(),
[] (QItemSelection &selection, const QModelIndex &index) {
[] (QItemSelection selection, const QModelIndex &index) {
if (index.isValid()) {
selection.merge(QItemSelection(index, index), QItemSelectionModel::Select);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment