From e199c6700a1cbc383f1d18d505ca1c9b135aa8dd Mon Sep 17 00:00:00 2001 From: Bill Date: Sun, 13 Nov 2022 02:57:40 +0800 Subject: [PATCH] fixed when ret in enable_if is invalid --- server/table.h | 65 +++++++++++++++++++++++------------------- server/vector_type.hpp | 1 + 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/server/table.h b/server/table.h index 5727ddc..af26ae7 100644 --- a/server/table.h +++ b/server/table.h @@ -720,51 +720,56 @@ inline void TableInfo::print(const char* __restrict sep, const char* _ std::cout << end; } } + +// use std::is_base_of here and all vt classes should derive from vector_base template class VT, class TRet> -using test_vt_support = typename std::enable_if_t, ColRef> || - std::is_same_v, ColView> || - std::is_same_v, vector_type>, TRet>; +using test_vt_support = typename std::enable_if_t< + std::is_base_of_v, VT>, + TRet>; -template class VT> -using get_autoext_type = test_vt_support::type>>; -template class VT> -using get_long_type = test_vt_support::type>>>; +template class VT, + test_vt_support* = nullptr> +using get_autoext_type = + decayed_t::type>; -template class VT> -using get_fp_type = test_vt_support::type>>>; +template class VT, + test_vt_support* = nullptr> +using get_long_type = + decayed_t::type>>; + +template class VT, + test_vt_support* = nullptr> +using get_fp_type = + decayed_t::type>>; template class VT, template class VT2, class TRet> -using test_vt_support2 = typename std::enable_if_t<(std::is_same_v, ColRef> || - std::is_same_v, ColView> || - std::is_same_v, vector_type>) && - (std::is_same_v, ColRef> || - std::is_same_v, ColView> || - std::is_same_v, vector_type>), TRet >; +using test_vt_support2 = typename std::enable_if_t< + std::is_base_of_v, VT> && + std::is_base_of_v, VT2>, + TRet >; + template class VT, template class VT2> -using get_autoext_type2 = test_vt_support2::type>>; + template class VT, template class VT2, + test_vt_support2* = nullptr > +using get_autoext_type2 = + decayed_t::type>; template class VT, template class VT2> -using get_long_type2 = test_vt_support2::type>>>; + template class VT, template class VT2, + test_vt_support2* = nullptr > +using get_long_type2 = + decayed_t::type>>; template class VT, template class VT2> -using get_fp_type2 = test_vt_support2::type>>>; + template class VT, template class VT2, + test_vt_support2* = nullptr > +using get_fp_type2 = + decayed_t::type>>; template class VT, template class VT2> get_autoext_type2 diff --git a/server/vector_type.hpp b/server/vector_type.hpp index ceb62e3..f817051 100644 --- a/server/vector_type.hpp +++ b/server/vector_type.hpp @@ -19,6 +19,7 @@ #pragma pack(push, 1) template struct vector_base {}; + struct vectortype_cstorage{ void* container; unsigned int size, capacity;