diff --git a/src/common/hash.h b/src/common/hash.h new file mode 100644 index 000000000..964f243b4 --- /dev/null +++ b/src/common/hash.h @@ -0,0 +1,29 @@ +/* + mkvmerge -- utility for splicing together matroska files + from component media subtypes + + Distributed under the GPL v2 + see the file COPYING for details + or visit http://www.gnu.org/copyleft/gpl.html + + Hash/unordered map helper functions + + Written by Moritz Bunkus . +*/ + +#ifndef MTX_COMMON_HASH_H +#define MTX_COMMON_HASH_H + +#include + +// Support for hashing all scoped and unscoped enums via their +// underlying type. +template +struct std::hash { + std::size_t operator()(Tkey const &key) const { + using T = typename std::underlying_type::type; + return std::hash()(static_cast(key)); + } +}; + +#endif // MTX_COMMON_HASH_H