From e0964bbc4f66e7d193abd249213c9cf762fd0294 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 30 Dec 2020 15:37:39 +0800 Subject: import(life): ... --- works/life/cpp-practicum/Base.hpp | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) (limited to 'works/life/cpp-practicum/Base.hpp') diff --git a/works/life/cpp-practicum/Base.hpp b/works/life/cpp-practicum/Base.hpp index f26b81f..bdf87dd 100644 --- a/works/life/cpp-practicum/Base.hpp +++ b/works/life/cpp-practicum/Base.hpp @@ -1,15 +1,8 @@ #pragma once -#include #include -// #include #include -// Now we have no gsl but we need gsl::index -namespace gsl { -using index = std::ptrdiff_t; -} - #define CRU_UNUSED(entity) static_cast(entity); #define CRU__CONCAT(a, b) a##b @@ -31,33 +24,7 @@ using index = std::ptrdiff_t; classname(classname &&) = delete; \ classname &operator=(classname &&) = delete; -namespace cru { -class Object { +class SerializationException : public std::runtime_error { public: - Object() = default; - CRU_DEFAULT_COPY(Object) - CRU_DEFAULT_MOVE(Object) - virtual ~Object() = default; -}; - -struct Interface { - Interface() = default; - CRU_DELETE_COPY(Interface) - CRU_DELETE_MOVE(Interface) - virtual ~Interface() = default; + using runtime_error::runtime_error; }; - -[[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; -} // namespace cru -- cgit v1.2.3