std::accumulate conversion

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2024-01-30 19:42:06 -08:00
committed by Urs Fleisch
parent cbb3de6836
commit 49be371caa

View File

@ -25,6 +25,7 @@
#include "xiphcomment.h"
#include <numeric>
#include <utility>
#include "tdebug.h"
@ -184,14 +185,8 @@ bool Ogg::XiphComment::isEmpty() const
unsigned int Ogg::XiphComment::fieldCount() const
{
unsigned int count = 0;
for(const auto &[_, list] : std::as_const(d->fieldListMap))
count += list.size();
count += d->pictureList.size();
return count;
auto f = [](unsigned int c, const auto &p) { return c + p.second.size(); };
return std::accumulate(d->fieldListMap.cbegin(), d->fieldListMap.cend(), d->pictureList.size(), f);
}
const Ogg::FieldListMap &Ogg::XiphComment::fieldListMap() const