Skip to content

Commit 49be371

Browse files
nehebufleisch
authored andcommitted
std::accumulate conversion
Signed-off-by: Rosen Penev <rosenp@gmail.com>
1 parent cbb3de6 commit 49be371

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

taglib/ogg/xiphcomment.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "xiphcomment.h"
2727

28+
#include <numeric>
2829
#include <utility>
2930

3031
#include "tdebug.h"
@@ -184,14 +185,8 @@ bool Ogg::XiphComment::isEmpty() const
184185

185186
unsigned int Ogg::XiphComment::fieldCount() const
186187
{
187-
unsigned int count = 0;
188-
189-
for(const auto &[_, list] : std::as_const(d->fieldListMap))
190-
count += list.size();
191-
192-
count += d->pictureList.size();
193-
194-
return count;
188+
auto f = [](unsigned int c, const auto &p) { return c + p.second.size(); };
189+
return std::accumulate(d->fieldListMap.cbegin(), d->fieldListMap.cend(), d->pictureList.size(), f);
195190
}
196191

197192
const Ogg::FieldListMap &Ogg::XiphComment::fieldListMap() const

0 commit comments

Comments
 (0)