diff options
Diffstat (limited to 'common/util.h')
-rw-r--r-- | common/util.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/common/util.h b/common/util.h index 2313a290..34b2ed02 100644 --- a/common/util.h +++ b/common/util.h @@ -27,7 +27,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> +template <typename Container, typename KeyType, typename ValueType> ValueType get_or_default(const Container &ct, const KeyType &key, ValueType def = ValueType()) { @@ -40,9 +40,8 @@ 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()) @@ -52,9 +51,8 @@ int int_or_default(const Container &ct, const KeyType &key, }; // As above, but convert to bool -template<typename Container, typename KeyType> -bool bool_or_default(const Container &ct, const KeyType &key, - bool def = false) +template <typename Container, typename KeyType> +bool bool_or_default(const Container &ct, const KeyType &key, bool def = false) { return bool(int_or_default(ct, key, int(def))); }; |