From c7c9c62fd3813a6230a2af7fc8c9882baa426a7f Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 28 Oct 2020 00:01:30 +0800 Subject: ... --- include/cru/common/Base.hpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'include/cru/common/Base.hpp') diff --git a/include/cru/common/Base.hpp b/include/cru/common/Base.hpp index a5a9421d..560f83bb 100644 --- a/include/cru/common/Base.hpp +++ b/include/cru/common/Base.hpp @@ -1,8 +1,8 @@ #pragma once #include "PreConfig.hpp" +#include #include - #include #define CRU_UNUSED(entity) static_cast(entity); @@ -42,12 +42,17 @@ struct Interface { virtual ~Interface() = default; }; -[[noreturn]] inline void UnreachableCode() { - throw std::runtime_error("Unreachable code."); -} +[[noreturn]] inline void UnreachableCode() { std::terminate(); } using Index = gsl::index; +// https://www.boost.org/doc/libs/1_54_0/doc/html/hash/reference.html#boost.hash_combine +template +inline void hash_combine(std::size_t& s, const T& v) { + std::hash h; + s ^= h(v) + 0x9e3779b9 + (s << 6) + (s >> 2); +} + #define CRU_DEFINE_CLASS_LOG_TAG(tag) \ private: \ constexpr static std::u16string_view log_tag = tag; -- cgit v1.2.3