diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index a5e306fd24d84..4f2762f253a8e 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -2380,8 +2380,8 @@ struct CargoesField { } }; -static_assert(MAX_CARGOES >= cpp_lengthof(IndustrySpec, produced_cargo)); -static_assert(MAX_CARGOES >= cpp_lengthof(IndustrySpec, accepts_cargo)); +static_assert(MAX_CARGOES >= std::tuple_size_v); +static_assert(MAX_CARGOES >= std::tuple_size_v); Dimension CargoesField::legend; ///< Dimension of the legend blob. Dimension CargoesField::cargo_border; ///< Dimensions of border between cargo lines and industry boxes. diff --git a/src/newgrf_storage.h b/src/newgrf_storage.h index cad016d6916d2..3d5ab0ac049bf 100644 --- a/src/newgrf_storage.h +++ b/src/newgrf_storage.h @@ -206,6 +206,6 @@ struct PersistentStorage : PersistentStorageArray, PersistentStora } }; -static_assert(cpp_lengthof(OldPersistentStorage, storage) <= cpp_lengthof(PersistentStorage, storage)); +static_assert(std::tuple_size_v <= std::tuple_size_v); #endif /* NEWGRF_STORAGE_H */ diff --git a/src/stdafx.h b/src/stdafx.h index 96b740fa4a1c4..3081beafe5a0a 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -301,14 +301,6 @@ char (&ArraySizeHelper(T (&array)[N]))[N]; */ #define cpp_sizeof(base, variable) (sizeof(std::declval().variable)) -/** - * Gets the length of an array variable within a class. - * @param base The class the variable is in. - * @param variable The array variable to get the size of. - * @return the length of the array - */ -#define cpp_lengthof(base, variable) (cpp_sizeof(base, variable) / cpp_sizeof(base, variable[0])) - /* take care of some name clashes on MacOS */ #if defined(__APPLE__)