diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/armnn/BackendId.hpp | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/include/armnn/BackendId.hpp b/include/armnn/BackendId.hpp index 72248bca34..8de985ec2f 100644 --- a/include/armnn/BackendId.hpp +++ b/include/armnn/BackendId.hpp @@ -132,31 +132,14 @@ private: std::string m_Id; }; -inline std::ostream& operator<<(std::ostream& os, const BackendId& id) -{ - os << id.Get(); - return os; -} - -template <template <class...> class TContainer> -inline std::ostream& operator<<(std::ostream& os, - const TContainer<BackendId>& ids) -{ - os << '['; - for (const auto& id : ids) { os << id << " "; } - os << ']'; - return os; } -using BackendIdSet = std::unordered_set<BackendId>; - -} // namespace armnn - namespace std { // make BackendId compatible with std hashtables by reusing the hash -// function for strings +// function for strings. +// Note this must come *before* the first use of unordered_set<BackendId>. template <> struct hash<armnn::BackendId> { @@ -168,3 +151,27 @@ struct hash<armnn::BackendId> }; } // namespace std + +namespace armnn +{ + +inline std::ostream& operator<<(std::ostream& os, const BackendId& id) +{ + os << id.Get(); + return os; +} + +template <template <typename...> class TContainer, typename... TContainerTemplateArgs> +std::ostream& operator<<(std::ostream& os, + const TContainer<BackendId, TContainerTemplateArgs...>& ids) +{ + os << '['; + for (const auto& id : ids) { os << id << " "; } + os << ']'; + return os; +} + +using BackendIdSet = std::unordered_set<BackendId>; + +} // namespace armnn + |