From: 이한종/동작제어Lab(SR)/Engineer/삼성전자 Date: Wed, 5 Sep 2018 01:02:28 +0000 (+0900) Subject: [neurun] Specialize `std::hash` for Index class (#2585) X-Git-Tag: 0.2~96 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fe2dc2f28e7c62d256695bb701111f92304baca;p=platform%2Fcore%2Fml%2Fnnfw.git [neurun] Specialize `std::hash` for Index class (#2585) (partially) Specialize `std::hash` for `graph::Index` class. This will enable having Index as the key in "std::unordered_.." containers. Signed-off-by: Hanjoung Lee --- diff --git a/runtimes/neurun/src/graph/Index.h b/runtimes/neurun/src/graph/Index.h index ac601dc..2f4cb18 100644 --- a/runtimes/neurun/src/graph/Index.h +++ b/runtimes/neurun/src/graph/Index.h @@ -1,6 +1,7 @@ #ifndef __NEURUN_GRAPH_INDEX_H__ #define __NEURUN_GRAPH_INDEX_H__ +#include #include namespace neurun @@ -42,4 +43,17 @@ private: } // namespace graph } // namespace neurun +namespace std +{ + +template struct hash<::neurun::graph::Index> +{ + size_t operator()(const ::neurun::graph::Index &index) const noexcept + { + return hash()(index.value()); + } +}; + +} // namespace std + #endif // __NEURUN_GRAPH_INDEX_H__