From 298ee421d9dcb6af3d29833f4cf636bb088356fb Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Thu, 15 Aug 2024 00:58:37 +0200 Subject: Some work on pointers --- asl/meta.hpp | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'asl/meta.hpp') diff --git a/asl/meta.hpp b/asl/meta.hpp index 15f7790..c55500a 100644 --- a/asl/meta.hpp +++ b/asl/meta.hpp @@ -8,6 +8,11 @@ template using bool_constant = integral_constant; using true_type = bool_constant; using false_type = bool_constant; +template struct _select_helper { using type = V; }; +template struct _select_helper { using type = U; }; + +template using select_t = _select_helper::type; + using nullptr_t = decltype(nullptr); template struct un_ref { using type = T; }; @@ -84,6 +89,50 @@ template concept is_member_object_ptr = is_member_ptr && !is_memb template concept is_fundamental = is_arithmetic || is_void || is_nullptr; template concept is_compound = !is_fundamental; template concept is_scalar = (is_fundamental && !is_void) || is_enum || is_ptr || is_member_ptr; -template concept is_object = is_scalar || is_array || is_class || is_union; +template concept is_object = is_scalar || is_class || is_union; + +template concept is_empty = is_void || __is_empty(T); + +struct empty {}; + +template using devoid_t = select_t, empty, T>; + +template struct _tame_helper { using type = F; }; + +#define ASL_TAME_IMPL(SUFFIX) \ + template \ + struct _tame_helper { using type = Ret(Args...); } + +ASL_TAME_IMPL(); +ASL_TAME_IMPL(const); +ASL_TAME_IMPL(volatile); +ASL_TAME_IMPL(volatile const); +ASL_TAME_IMPL(&&); +ASL_TAME_IMPL(const &&); +ASL_TAME_IMPL(volatile &&); +ASL_TAME_IMPL(volatile const &&); +ASL_TAME_IMPL(&); +ASL_TAME_IMPL(const &); +ASL_TAME_IMPL(volatile &); +ASL_TAME_IMPL(volatile const &); +ASL_TAME_IMPL(noexcept); +ASL_TAME_IMPL(const noexcept); +ASL_TAME_IMPL(volatile noexcept); +ASL_TAME_IMPL(volatile const noexcept); +ASL_TAME_IMPL(&& noexcept); +ASL_TAME_IMPL(const && noexcept); +ASL_TAME_IMPL(volatile && noexcept); +ASL_TAME_IMPL(volatile const && noexcept); +ASL_TAME_IMPL(& noexcept); +ASL_TAME_IMPL(const & noexcept); +ASL_TAME_IMPL(volatile & noexcept); +ASL_TAME_IMPL(volatile const & noexcept); + +#undef ASL_TAME_IMPL + +template using tame_t = _tame_helper::type; + +template using as_raw_ptr_t = un_ref_t>*; + } // namespace asl -- cgit