Changed for-loop to std::transform.

This commit is contained in:
tastytea 2019-03-30 23:59:27 +01:00
parent 07c39ab4bf
commit 94651f8dba
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 4 additions and 4 deletions

View File

@ -16,6 +16,7 @@
#include <sstream>
#include <iomanip>
#include <algorithm>
#include "tag.hpp"
#include "debug.hpp"
@ -49,10 +50,9 @@ const std::vector<Tag::History> Tag::history() const
if (node.isArray())
{
std::vector<Easy::Tag::History> vec;
for (const Json::Value &value : node)
{
vec.push_back(Easy::Tag::History(value.toStyledString()));
}
std::transform(node.begin(), node.end(), std::back_inserter(vec),
[](const Json::Value &value)
{ return Easy::Tag::History(value); });
return vec;
}