1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 07:31:15 +02:00

Bindings: Add a method for iterating in lexicographically sorted order

This commit is contained in:
Eelco Dolstra 2017-01-25 16:06:50 +01:00
parent b1f001538e
commit 54801ed6ad
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 28 additions and 28 deletions

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 << "}";