Changed for-loop to std::transform.

This commit is contained in:
tastytea 2019-03-30 23:15:22 +01:00
parent 7ac5b2545a
commit d84a18a0e7
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 4 additions and 4 deletions

View File

@ -19,6 +19,7 @@
#include <sstream>
#include <chrono>
#include <regex>
#include <algorithm>
#include "easy/entity.hpp"
#include "debug.hpp"
@ -237,10 +238,9 @@ const std::vector<string> Easy::Entity::get_vector(const string &key) const
if (node.isArray())
{
std::vector<string> vec;
for (const Json::Value &value : node)
{
vec.push_back(value.asString());
}
std::transform(node.begin(), node.end(), std::back_inserter(vec),
[=](const Json::Value &value)
{ return value.asString(); });
_was_set = true;
return vec;
}