Base: sort returned Unit schema description
Return schemas name and description vectors sorted by number, so
index can be used later to select particular schema.
Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
This commit is contained in:
@@ -53,7 +53,11 @@ size_t UnitsSchemas::count() const
|
||||
std::vector<std::string> UnitsSchemas::getVec(const std::function<std::string(UnitsSchemaSpec)>& fn)
|
||||
{
|
||||
std::vector<std::string> vec;
|
||||
std::transform(pack.specs.begin(), pack.specs.end(), std::back_inserter(vec), fn);
|
||||
auto specs = pack.specs;
|
||||
std::sort(specs.begin(), specs.end(), [](const UnitsSchemaSpec& a, const UnitsSchemaSpec& b) {
|
||||
return a.num < b.num;
|
||||
});
|
||||
std::transform(specs.begin(), specs.end(), std::back_inserter(vec), fn);
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user