Make C++17 minimum requirement

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2023-11-10 08:36:33 +01:00
parent 57ccb713ad
commit cc8a6eeee7
6 changed files with 13 additions and 29 deletions

View File

@ -1 +1,6 @@
# stdex - Random stuff that didn't made it into std C++ # stdex - Random stuff that didn't made it into std C++
## Requirements
- MSVC 2019 or later, XCode 13 or later
- C++17 or later

View File

@ -15,20 +15,14 @@
namespace stdex namespace stdex
{ {
/// \cond internal /// \cond internal
#if _HAS_CXX17 inline const char base64_enc_lookup[64] = {
inline
#endif
const char base64_enc_lookup[64] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', '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', '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', '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', '+', '/' 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
}; };
#if _HAS_CXX17 inline const uint8_t base64_dec_lookup[256] = {
inline
#endif
const uint8_t base64_dec_lookup[256] = {
/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ /* 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, /* 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, /* 1 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,

View File

@ -172,12 +172,6 @@
#endif #endif
#endif #endif
#if _HAS_CXX17
#define _Constexpr_ constexpr
#else
#define _Constexpr_
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#define _Deprecated_(message) __declspec(deprecated(message)) #define _Deprecated_(message) __declspec(deprecated(message))
#else #else

View File

@ -13,10 +13,7 @@ namespace stdex
wchar_t unicode[3]; ///< Unicode string representation wchar_t unicode[3]; ///< Unicode string representation
}; };
#if _HAS_CXX17 inline const sgml_unicode_pair sgml_unicode[] = {
inline
#endif
const sgml_unicode_pair sgml_unicode[] = {
{ "AElig", L"\u00c6" }, { "AElig", L"\u00c6" },
{ "Aacgr", L"\u0386" }, { "Aacgr", L"\u0386" },
{ "Aacute", L"\u00c1" }, { "Aacute", L"\u00c1" },
@ -1554,10 +1551,7 @@ namespace stdex
{ "zwnj", L"\u200c" }, { "zwnj", L"\u200c" },
}; };
#if _HAS_CXX17 inline const size_t unicode_sgml[] = {
inline
#endif
const size_t unicode_sgml[] = {
0x5b6, 0x5b6,
0x48d, 0x48d,
0x30d, 0x30d,

View File

@ -48,10 +48,7 @@ namespace stdex
/// ///
/// System information /// System information
/// ///
#if _HAS_CXX17 inline const struct sys_info_t
inline
#endif
const struct sys_info_t
{ {
/// ///
/// The platform this process was compiled for /// The platform this process was compiled for

View File

@ -125,7 +125,7 @@ namespace stdex
} }
#pragma warning(suppress: 4127) #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); _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
// Try to convert to stack buffer first. // Try to convert to stack buffer first.
@ -149,7 +149,7 @@ namespace stdex
} }
#pragma warning(suppress: 4127) #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); _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
// Try to convert to stack buffer first. // Try to convert to stack buffer first.
@ -173,7 +173,7 @@ namespace stdex
} }
#pragma warning(suppress: 4127) #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); _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
// Try to convert to stack buffer first. // Try to convert to stack buffer first.