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 --- CMakeLists.txt | 2 +- src/editor/properties.h | 9 +++++---- src/util/allocator.h | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 561d10c..215cb40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10) project(videogame) set(CMAKE_CXX_COMPILER "clang++") -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) file(GLOB_RECURSE SRC_FILES ./src/*.cpp ./src/game/*.cpp ./src/util/config/*.cpp) 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 diff --git a/src/util/allocator.h b/src/util/allocator.h index 0cb8fa2..ff3d3c5 100644 --- a/src/util/allocator.h +++ b/src/util/allocator.h @@ -83,7 +83,6 @@ struct LIST { capacity = _size; } - LIST( const LIST& other ) { if( this == &other ) return; -- cgit v1.2.3