diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-06-25 21:33:48 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-06-25 21:33:48 +0200 |
commit | db890d3a81bfe6760e9f4ea981798269abb60a20 (patch) | |
tree | ddae875c970642d6b79bb09ae201abe5f280c050 /common/util.h | |
parent | 64208da1f986f104682c9c050c43f2273900810a (diff) | |
download | nextpnr-db890d3a81bfe6760e9f4ea981798269abb60a20.tar.gz nextpnr-db890d3a81bfe6760e9f4ea981798269abb60a20.tar.bz2 nextpnr-db890d3a81bfe6760e9f4ea981798269abb60a20.zip |
nets and cells are unique_ptr's
Diffstat (limited to 'common/util.h')
-rw-r--r-- | common/util.h | 7 |
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 |