about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-01-25T15·06+0100
committerEelco Dolstra <edolstra@gmail.com>2017-01-26T19·40+0100
commit54801ed6ad4e0ea8faa67b0b4ba10debeb824d3b (patch)
tree3e8f94aad34c4b1011cf77b1f6527d3f09f2c502 /src/libexpr/eval.cc
parentb1f001538e41a4f28e315baeede93a8fe70d6d62 (diff)
Bindings: Add a method for iterating in lexicographically sorted order
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 64f3874db614..5f9f5bac1ed6 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -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 << "}";