Changed for-loop to std::transform.
This commit is contained in:
parent
7ac5b2545a
commit
d84a18a0e7
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue
Block a user