aboutsummaryrefslogtreecommitdiffstats
path: root/common/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/util.h')
-rw-r--r--common/util.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/util.h b/common/util.h
index 5e938635..b1cab650 100644
--- a/common/util.h
+++ b/common/util.h
@@ -57,9 +57,12 @@ bool bool_or_default(const Container &ct, const KeyType &key, bool def = false)
};
// Wrap an unordered_map, and allow it to be iterated over sorted by key
-template <typename K, typename V> std::map<K, V> sorted(const std::unordered_map<K, V> &orig)
+template <typename K, typename V> std::map<K, V*> sorted(const std::unordered_map<K, std::unique_ptr<V>> &orig)
{
- return std::map<K, V>(orig.begin(), orig.end());
+ std::map<K, V*> retVal;
+ for(auto& item : orig)
+ retVal.emplace(std::make_pair(item.first,item.second.get()));
+ return retVal;
};
NEXTPNR_NAMESPACE_END