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

View File

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