From b76375633cb81937da5ad3f8a1bb659303205d4a Mon Sep 17 00:00:00 2001 From: mutouyun Date: Sun, 27 Jan 2019 15:43:07 +0800 Subject: [PATCH] compile error (TBD) --- src/id_pool.h | 2 +- src/ipc.cpp | 2 +- src/memory/alloc.h | 2 +- src/platform/detail.h | 11 ++++------- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/id_pool.h b/src/id_pool.h index 87b2cda..7d4cedf 100644 --- a/src/id_pool.h +++ b/src/id_pool.h @@ -37,7 +37,7 @@ struct id_type<0, AlignSize> { }; template + std::size_t AlignSize = ipc::detail::min_val(DataSize, alignof(std::size_t))> class id_pool { public: enum : std::size_t { diff --git a/src/ipc.cpp b/src/ipc.cpp index fa76797..0253de7 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -23,7 +23,7 @@ using namespace ipc; using msg_id_t = std::size_t; template + std::size_t AlignSize = ipc::detail::min_val(DataSize, alignof(std::size_t))> struct msg_t; template diff --git a/src/memory/alloc.h b/src/memory/alloc.h index ace13a5..7e2054e 100644 --- a/src/memory/alloc.h +++ b/src/memory/alloc.h @@ -150,7 +150,7 @@ public: using alloc_policy = AllocP; enum : std::size_t { - block_size = (ipc::detail::max)(BlockSize, sizeof(void*)) + block_size = ipc::detail::max_val(BlockSize, sizeof(void*)) }; private: diff --git a/src/platform/detail.h b/src/platform/detail.h index c0f0c6e..d7e4031 100644 --- a/src/platform/detail.h +++ b/src/platform/detail.h @@ -5,7 +5,6 @@ #include #include #include -#include #include #include "def.h" @@ -57,8 +56,6 @@ namespace detail { using std::unique_ptr; using std::unique_lock; using std::shared_lock; -using std::max; -using std::min; #else /*__cplusplus < 201703L*/ @@ -83,18 +80,18 @@ constexpr auto shared_lock(T&& lc) { return std::shared_lock> { std::forward(lc) }; } +#endif/*__cplusplus < 201703L*/ + template -constexpr T const & max(const T& a, const T& b) { +constexpr T const & max_val(const T& a, const T& b) { return a < b ? b : a; } template -constexpr T const & min(const T& a, const T& b) { +constexpr T const & min_val(const T& a, const T& b) { return b < a ? b : a; } -#endif/*__cplusplus < 201703L*/ - std::size_t calc_unique_id(); template