From cc8a6eeee7856277ff822ebaaa764b6e3390b521 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 10 Nov 2023 08:36:33 +0100 Subject: [PATCH] Make C++17 minimum requirement Signed-off-by: Simon Rozman --- README.md | 5 +++++ include/stdex/base64.hpp | 10 ++-------- include/stdex/compat.hpp | 6 ------ include/stdex/sgml_unicode.hpp | 10 ++-------- include/stdex/sys_info.hpp | 5 +---- include/stdex/unicode.hpp | 6 +++--- 6 files changed, 13 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 0ae61ca64..dc364c780 100644 --- a/README.md +++ b/README.md @@ -1 +1,6 @@ # stdex - Random stuff that didn't made it into std C++ + +## Requirements + +- MSVC 2019 or later, XCode 13 or later +- C++17 or later diff --git a/include/stdex/base64.hpp b/include/stdex/base64.hpp index f7f56d00d..66f0bae1a 100644 --- a/include/stdex/base64.hpp +++ b/include/stdex/base64.hpp @@ -15,20 +15,14 @@ namespace stdex { /// \cond internal -#if _HAS_CXX17 - inline -#endif - const char base64_enc_lookup[64] = { + inline const char base64_enc_lookup[64] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; -#if _HAS_CXX17 - inline -#endif - const uint8_t base64_dec_lookup[256] = { + inline const uint8_t base64_dec_lookup[256] = { /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ /* 0 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, diff --git a/include/stdex/compat.hpp b/include/stdex/compat.hpp index a0dc65d66..939d7349d 100644 --- a/include/stdex/compat.hpp +++ b/include/stdex/compat.hpp @@ -172,12 +172,6 @@ #endif #endif -#if _HAS_CXX17 -#define _Constexpr_ constexpr -#else -#define _Constexpr_ -#endif - #ifdef _MSC_VER #define _Deprecated_(message) __declspec(deprecated(message)) #else diff --git a/include/stdex/sgml_unicode.hpp b/include/stdex/sgml_unicode.hpp index 4f26e2923..f976743ac 100644 --- a/include/stdex/sgml_unicode.hpp +++ b/include/stdex/sgml_unicode.hpp @@ -13,10 +13,7 @@ namespace stdex wchar_t unicode[3]; ///< Unicode string representation }; -#if _HAS_CXX17 - inline -#endif - const sgml_unicode_pair sgml_unicode[] = { + inline const sgml_unicode_pair sgml_unicode[] = { { "AElig", L"\u00c6" }, { "Aacgr", L"\u0386" }, { "Aacute", L"\u00c1" }, @@ -1554,10 +1551,7 @@ namespace stdex { "zwnj", L"\u200c" }, }; -#if _HAS_CXX17 - inline -#endif - const size_t unicode_sgml[] = { + inline const size_t unicode_sgml[] = { 0x5b6, 0x48d, 0x30d, diff --git a/include/stdex/sys_info.hpp b/include/stdex/sys_info.hpp index 6f0b05f46..194ede03b 100644 --- a/include/stdex/sys_info.hpp +++ b/include/stdex/sys_info.hpp @@ -48,10 +48,7 @@ namespace stdex /// /// System information /// -#if _HAS_CXX17 - inline -#endif - const struct sys_info_t + inline const struct sys_info_t { /// /// The platform this process was compiled for diff --git a/include/stdex/unicode.hpp b/include/stdex/unicode.hpp index dd2494c74..9556724c2 100644 --- a/include/stdex/unicode.hpp +++ b/include/stdex/unicode.hpp @@ -125,7 +125,7 @@ namespace stdex } #pragma warning(suppress: 4127) - if _Constexpr_ (sizeof(T_from) == sizeof(char) && sizeof(T_to) == sizeof(wchar_t)) { + if constexpr (sizeof(T_from) == sizeof(char) && sizeof(T_to) == sizeof(wchar_t)) { _Assume_(count_src < INT_MAX || count_src == SIZE_MAX); // Try to convert to stack buffer first. @@ -149,7 +149,7 @@ namespace stdex } #pragma warning(suppress: 4127) - if _Constexpr_ (sizeof(T_from) == sizeof(wchar_t) && sizeof(T_to) == sizeof(char)) { + if constexpr (sizeof(T_from) == sizeof(wchar_t) && sizeof(T_to) == sizeof(char)) { _Assume_(count_src < INT_MAX || count_src == SIZE_MAX); // Try to convert to stack buffer first. @@ -173,7 +173,7 @@ namespace stdex } #pragma warning(suppress: 4127) - if _Constexpr_ (sizeof(T_from) == sizeof(char) && sizeof(T_to) == sizeof(char)) { + if constexpr (sizeof(T_from) == sizeof(char) && sizeof(T_to) == sizeof(char)) { _Assume_(count_src < INT_MAX || count_src == SIZE_MAX); // Try to convert to stack buffer first.