diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-06-23 16:14:39 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2018-06-23 16:14:39 +0200 |
commit | 0ccd9febebdb7f2de700d116a8498f23de093e88 (patch) | |
tree | 094f717951a81fd91d01e3d776695629f354d089 /common/util.h | |
parent | a40d9dc514b680538d0ffa99873974a15bff9e97 (diff) | |
parent | 1e8840b0f9400a1dc17ba6c7496314f82f0db2e1 (diff) | |
download | nextpnr-0ccd9febebdb7f2de700d116a8498f23de093e88.tar.gz nextpnr-0ccd9febebdb7f2de700d116a8498f23de093e88.tar.bz2 nextpnr-0ccd9febebdb7f2de700d116a8498f23de093e88.zip |
Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
Diffstat (limited to 'common/util.h')
-rw-r--r-- | common/util.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/common/util.h b/common/util.h index 4c60292b..5e938635 100644 --- a/common/util.h +++ b/common/util.h @@ -29,8 +29,7 @@ NEXTPNR_NAMESPACE_BEGIN // Get a value from a map-style container, returning default if value is not // found template <typename Container, typename KeyType, typename ValueType> -ValueType get_or_default(const Container &ct, const KeyType &key, - ValueType def = ValueType()) +ValueType get_or_default(const Container &ct, const KeyType &key, ValueType def = ValueType()) { auto found = ct.find(key); if (found == ct.end()) @@ -41,8 +40,7 @@ ValueType get_or_default(const Container &ct, const KeyType &key, // Get a value from a map-style container, converting to int, and returning // default if value is not found -template <typename Container, typename KeyType> -int int_or_default(const Container &ct, const KeyType &key, int def = 0) +template <typename Container, typename KeyType> int int_or_default(const Container &ct, const KeyType &key, int def = 0) { auto found = ct.find(key); if (found == ct.end()) @@ -59,8 +57,7 @@ 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, V> &orig) { return std::map<K, V>(orig.begin(), orig.end()); }; |