diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-04-24 11:41:58 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-04-24 11:43:13 +0200 |
commit | dee65d14351a419cfeaac0e1e0da0a497bd445fb (patch) | |
tree | 55d5c656a1043ee75bf25439adda6b8101ac3819 /core | |
parent | 7abe0c6014022874378cb64a11b26b0f0f178324 (diff) | |
download | redot-engine-dee65d14351a419cfeaac0e1e0da0a497bd445fb.tar.gz |
Redefine GetSimpleTypeT<> in terms of <type_traits>
Diffstat (limited to 'core')
-rw-r--r-- | core/templates/command_queue_mt.h | 2 | ||||
-rw-r--r-- | core/templates/simple_type.h | 21 | ||||
-rw-r--r-- | core/variant/binder_common.h | 16 | ||||
-rw-r--r-- | core/variant/variant_internal.h | 2 |
4 files changed, 12 insertions, 29 deletions
diff --git a/core/templates/command_queue_mt.h b/core/templates/command_queue_mt.h index a4ac338bed..0c86bdb762 100644 --- a/core/templates/command_queue_mt.h +++ b/core/templates/command_queue_mt.h @@ -208,7 +208,7 @@ #define ARG(N) p##N #define PARAM(N) P##N p##N #define TYPE_PARAM(N) typename P##N -#define PARAM_DECL(N) typename GetSimpleTypeT<P##N>::type_t p##N +#define PARAM_DECL(N) GetSimpleTypeT<P##N> p##N #define DECL_CMD(N) \ template <typename T, typename M COMMA(N) COMMA_SEP_LIST(TYPE_PARAM, N)> \ diff --git a/core/templates/simple_type.h b/core/templates/simple_type.h index b2ae0110e2..197115ddb9 100644 --- a/core/templates/simple_type.h +++ b/core/templates/simple_type.h @@ -31,26 +31,9 @@ #ifndef SIMPLE_TYPE_H #define SIMPLE_TYPE_H -/* Batch of specializations to obtain the actual simple type */ +#include <type_traits> template <typename T> -struct GetSimpleTypeT { - typedef T type_t; -}; - -template <typename T> -struct GetSimpleTypeT<T &> { - typedef T type_t; -}; - -template <typename T> -struct GetSimpleTypeT<T const> { - typedef T type_t; -}; - -template <typename T> -struct GetSimpleTypeT<T const &> { - typedef T type_t; -}; +using GetSimpleTypeT = typename std::remove_cv_t<std::remove_reference_t<T>>; #endif // SIMPLE_TYPE_H diff --git a/core/variant/binder_common.h b/core/variant/binder_common.h index 0fe4518b0f..61b90e2a26 100644 --- a/core/variant/binder_common.h +++ b/core/variant/binder_common.h @@ -362,42 +362,42 @@ void call_with_ptr_args_static_method_helper(void (*p_method)(P...), const void template <typename T, typename... P, size_t... Is> void call_with_validated_variant_args_helper(T *p_instance, void (T::*p_method)(P...), const Variant **p_args, IndexSequence<Is...>) { - (p_instance->*p_method)((VariantInternalAccessor<typename GetSimpleTypeT<P>::type_t>::get(p_args[Is]))...); + (p_instance->*p_method)((VariantInternalAccessor<GetSimpleTypeT<P>>::get(p_args[Is]))...); } template <typename T, typename... P, size_t... Is> void call_with_validated_variant_argsc_helper(T *p_instance, void (T::*p_method)(P...) const, const Variant **p_args, IndexSequence<Is...>) { - (p_instance->*p_method)((VariantInternalAccessor<typename GetSimpleTypeT<P>::type_t>::get(p_args[Is]))...); + (p_instance->*p_method)((VariantInternalAccessor<GetSimpleTypeT<P>>::get(p_args[Is]))...); } template <typename T, typename R, typename... P, size_t... Is> void call_with_validated_variant_args_ret_helper(T *p_instance, R (T::*p_method)(P...), const Variant **p_args, Variant *r_ret, IndexSequence<Is...>) { - VariantInternalAccessor<typename GetSimpleTypeT<R>::type_t>::set(r_ret, (p_instance->*p_method)((VariantInternalAccessor<typename GetSimpleTypeT<P>::type_t>::get(p_args[Is]))...)); + VariantInternalAccessor<GetSimpleTypeT<R>>::set(r_ret, (p_instance->*p_method)((VariantInternalAccessor<GetSimpleTypeT<P>>::get(p_args[Is]))...)); } template <typename T, typename R, typename... P, size_t... Is> void call_with_validated_variant_args_retc_helper(T *p_instance, R (T::*p_method)(P...) const, const Variant **p_args, Variant *r_ret, IndexSequence<Is...>) { - VariantInternalAccessor<typename GetSimpleTypeT<R>::type_t>::set(r_ret, (p_instance->*p_method)((VariantInternalAccessor<typename GetSimpleTypeT<P>::type_t>::get(p_args[Is]))...)); + VariantInternalAccessor<GetSimpleTypeT<R>>::set(r_ret, (p_instance->*p_method)((VariantInternalAccessor<GetSimpleTypeT<P>>::get(p_args[Is]))...)); } template <typename T, typename R, typename... P, size_t... Is> void call_with_validated_variant_args_static_retc_helper(T *p_instance, R (*p_method)(T *, P...), const Variant **p_args, Variant *r_ret, IndexSequence<Is...>) { - VariantInternalAccessor<typename GetSimpleTypeT<R>::type_t>::set(r_ret, p_method(p_instance, (VariantInternalAccessor<typename GetSimpleTypeT<P>::type_t>::get(p_args[Is]))...)); + VariantInternalAccessor<GetSimpleTypeT<R>>::set(r_ret, p_method(p_instance, (VariantInternalAccessor<GetSimpleTypeT<P>>::get(p_args[Is]))...)); } template <typename T, typename... P, size_t... Is> void call_with_validated_variant_args_static_helper(T *p_instance, void (*p_method)(T *, P...), const Variant **p_args, IndexSequence<Is...>) { - p_method(p_instance, (VariantInternalAccessor<typename GetSimpleTypeT<P>::type_t>::get(p_args[Is]))...); + p_method(p_instance, (VariantInternalAccessor<GetSimpleTypeT<P>>::get(p_args[Is]))...); } template <typename R, typename... P, size_t... Is> void call_with_validated_variant_args_static_method_ret_helper(R (*p_method)(P...), const Variant **p_args, Variant *r_ret, IndexSequence<Is...>) { - VariantInternalAccessor<typename GetSimpleTypeT<R>::type_t>::set(r_ret, p_method((VariantInternalAccessor<typename GetSimpleTypeT<P>::type_t>::get(p_args[Is]))...)); + VariantInternalAccessor<GetSimpleTypeT<R>>::set(r_ret, p_method((VariantInternalAccessor<GetSimpleTypeT<P>>::get(p_args[Is]))...)); } template <typename... P, size_t... Is> void call_with_validated_variant_args_static_method_helper(void (*p_method)(P...), const Variant **p_args, IndexSequence<Is...>) { - p_method((VariantInternalAccessor<typename GetSimpleTypeT<P>::type_t>::get(p_args[Is]))...); + p_method((VariantInternalAccessor<GetSimpleTypeT<P>>::get(p_args[Is]))...); } template <typename T, typename... P> diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h index dbd4a6a7ad..337770cf54 100644 --- a/core/variant/variant_internal.h +++ b/core/variant/variant_internal.h @@ -1511,7 +1511,7 @@ struct VariantTypeChanger { template <typename T> struct VariantTypeAdjust { _FORCE_INLINE_ static void adjust(Variant *r_ret) { - VariantTypeChanger<typename GetSimpleTypeT<T>::type_t>::change(r_ret); + VariantTypeChanger<GetSimpleTypeT<T>>::change(r_ret); } }; |