diff -r 90bf9049e5eb -r 2e6cbacafdc7 sources/basics.h --- a/sources/basics.h Wed Jan 27 19:28:18 2021 +0200 +++ b/sources/basics.h Wed Jan 27 19:32:55 2021 +0200 @@ -30,8 +30,8 @@ #pragma once #include +#include #include -#include #if !defined(_MSC_VER) && !defined(__cdecl) # define __cdecl @@ -74,8 +74,8 @@ BEGIN_ZFC_NAMESPACE -template -T min (T a, T b) +template +constexpr std::common_type_t min(T a, TT b) { return (a < b) ? a : b; } @@ -91,8 +91,8 @@ return result; } -template -T max (T a, T b) +template +constexpr std::common_type_t max(T a, TT b) { return (a > b) ? a : b; } @@ -109,7 +109,7 @@ } template -std::common_type_t clamp(T a, TT b, TTT c) +constexpr std::common_type_t clamp(T a, TT b, TTT c) { return (a < b) ? b : (a > c) ? c : a; } @@ -119,9 +119,11 @@ return value != 1 ? "s" : ""; } -template -char (&_ArraySizeHelper(T (&array)[N]))[N]; -#define countof(array) (sizeof(_ArraySizeHelper( array ))) +template +constexpr std::size_t countof(T(&)[N]) +{ + return N; +} struct Exitception {};