diff options
| author | aura <nw@moneybot.cc> | 2026-03-13 06:05:26 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-03-13 06:05:26 +0100 |
| commit | 59ca7ecafca84fa62ee8d54d0e48521b7e4c0a95 (patch) | |
| tree | 63f3a870116befa13cc4db005ce8ac7d717ed9aa /src/editor/properties.h | |
| parent | d42d218a3685c030a7370d30f2de5495ea526d99 (diff) | |
upgrade to c++20 bcuz why not
Diffstat (limited to 'src/editor/properties.h')
| -rw-r--r-- | src/editor/properties.h | 9 |
1 files changed, 5 insertions, 4 deletions
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 <concepts> #if IS_EDITOR #include <math.h> @@ -44,6 +45,9 @@ struct EOBJECT { LIST<struct EDITOR_PROP*> eprops{}; }; +template <typename T> +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<F32> { static const U8 type = EPROP_F32; }; template <> struct __eprop_type<F64> { static const U8 type = EPROP_F64; }; template <> struct __eprop_type<STR> { static const U8 type = EPROP_STRING; }; - template <> struct __eprop_type<EOBJECT> { static const U8 type = EPROP_OBJ; }; + template <__eobject_base T> struct __eprop_type<T> { static const U8 type = EPROP_OBJ; }; template <typename LT> struct __eprop_type<LIST<LT>> { static const U8 type = EPROP_LIST; }; template <> struct __eprop_type<LIST<struct MAP_TEXTURE_ENTRY*>> { static const U8 type = EPROP_TEXTURE_LIST; }; }; template <typename T> const U8 eprop_type() { - if constexpr( __is_base_of( EOBJECT, T ) ) - return EPROP_OBJ; - return EDITOR_PROP::__eprop_type<T>::type; } #else |
