Bindings: Add a method for iterating in lexicographically sorted order

This commit is contained in:
Eelco Dolstra
2017-01-26 20:40:33 +01:00
parent b1f001538e
commit 54801ed6ad
4 changed files with 28 additions and 28 deletions
+3 -7
View File
@@ -91,13 +91,9 @@ static void printValue(std::ostream & str, std::set<const Value *> & active, con
break;
case tAttrs: {
str << "{ ";
typedef std::map<string, Value *> Sorted;
Sorted sorted;
for (auto & i : *v.attrs)
sorted[i.name] = i.value;
for (auto & i : sorted) {
str << i.first << " = ";
printValue(str, active, *i.second);
for (auto & i : v.attrs->lexicographicOrder()) {
str << i->name << " = ";
printValue(str, active, *i->value);
str << "; ";
}
str << "}";