From 32b00eb433f9efc7a7afe83d0c04d3fd2ad25582 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 21 Oct 2023 19:05:08 +0200 Subject: [PATCH] Add new operator GENTYPE --- README.md | 1 + m-core.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 296ec5ba..8943913b 100644 --- a/README.md +++ b/README.md @@ -611,6 +611,7 @@ Other documented operators are: * NAME() --> prefix: Return the base name (prefix) used to construct the container. * TYPE() --> type: Return the base type associated to this oplist. * SUBTYPE() --> type: Return the type of the element stored in the container (used to iterate over the container). +* GENTYPE() --> type: Return the type representing TYPE suitable for a _Generic statement. * OPLIST() --> oplist: Return the oplist of the type of the elements stored in the container. * KEY\_TYPE() --> key\_t: Return the key type for associative containers. * VALUE\_TYPE() --> value\_t: Return the value type for associative containers. diff --git a/m-core.h b/m-core.h index 068d6877..3693b803 100644 --- a/m-core.h +++ b/m-core.h @@ -3359,6 +3359,7 @@ M_INLINE size_t m_core_cstr_hash(const char str[]) #define M_CMP_CMP(a) ,a, #define M_TYPE_TYPE(a) ,a, #define M_SUBTYPE_SUBTYPE(a) ,a, +#define M_GENTYPE_GENTYPE(a) ,a, #define M_NAME_NAME(a) ,a, #define M_OPLIST_OPLIST(a) ,a, #define M_SORT_SORT(a) ,a, @@ -3448,6 +3449,7 @@ M_INLINE size_t m_core_cstr_hash(const char str[]) #define M_GET_CMP(...) M_GET_METHOD(CMP, M_CMP_DEFAULT, __VA_ARGS__) #define M_GET_TYPE(...) M_GET_METHOD(TYPE, M_NO_DEF_TYPE, __VA_ARGS__) #define M_GET_SUBTYPE(...) M_GET_METHOD(SUBTYPE, M_NO_DEF_TYPE, __VA_ARGS__) +#define M_GET_GENTYPE(...) M_GET_METHOD(GENTYPE, M_NO_DEF_TYPE, __VA_ARGS__) #define M_GET_NAME(...) M_GET_METHOD(NAME, M_NO_DEF_TYPE, __VA_ARGS__) #define M_GET_OPLIST(...) M_GET_METHOD(OPLIST, (), __VA_ARGS__) #define M_GET_SORT(...) M_GET_METHOD(SORT, M_NO_DEFAULT, __VA_ARGS__) @@ -3528,6 +3530,7 @@ M_INLINE size_t m_core_cstr_hash(const char str[]) #define M_CALL_CMP(oplist, ...) M_APPLY_API(M_GET_CMP oplist, oplist, __VA_ARGS__) //#define M_CALL_TYPE(oplist, ...) M_APPLY_API(M_GET_TYPE oplist, oplist, __VA_ARGS__) //#define M_CALL_SUBTYPE(oplist, ...) M_APPLY_API(M_GET_SUBTYPE oplist, oplist, __VA_ARGS__) +//#define M_CALL_GENTYPE(oplist, ...) M_APPLY_API(M_GET_GENTYPE oplist, oplist, __VA_ARGS__) //#define M_CALL_NAME(oplist, ...) M_APPLY_API(M_GET_NAME oplist, oplist, __VA_ARGS__) //#define M_CALL_OPLIST(oplist, ...) M_APPLY_API(M_GET_OPLIST oplist, oplist, __VA_ARGS__) #define M_CALL_SORT(oplist, ...) M_APPLY_API(M_GET_SORT oplist, oplist, __VA_ARGS__)