From 59ca7ecafca84fa62ee8d54d0e48521b7e4c0a95 Mon Sep 17 00:00:00 2001 From: aura Date: Fri, 13 Mar 2026 06:05:26 +0100 Subject: upgrade to c++20 bcuz why not --- src/editor/properties.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/editor') diff --git a/src/editor/properties.h b/src/editor/properties.h index f3d55b5..34ac765 100644 --- a/src/editor/properties.h +++ b/src/editor/properties.h @@ -1,6 +1,7 @@ #pragma once #include "../gamedef.h" +#include #if IS_EDITOR #include @@ -44,6 +45,9 @@ struct EOBJECT { LIST eprops{}; }; +template +concept __eobject_base = __is_base_of(EOBJECT, T); + // editor object property struct EDITOR_PROP { void* pdata; @@ -68,16 +72,13 @@ struct EDITOR_PROP { template <> struct __eprop_type { static const U8 type = EPROP_F32; }; template <> struct __eprop_type { static const U8 type = EPROP_F64; }; template <> struct __eprop_type { static const U8 type = EPROP_STRING; }; - template <> struct __eprop_type { static const U8 type = EPROP_OBJ; }; + template <__eobject_base T> struct __eprop_type { static const U8 type = EPROP_OBJ; }; template struct __eprop_type> { static const U8 type = EPROP_LIST; }; template <> struct __eprop_type> { static const U8 type = EPROP_TEXTURE_LIST; }; }; template const U8 eprop_type() { - if constexpr( __is_base_of( EOBJECT, T ) ) - return EPROP_OBJ; - return EDITOR_PROP::__eprop_type::type; } #else -- cgit v1.2.3