Fix to support pre-C++17

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2023-09-14 13:01:16 +02:00
parent 13703b1747
commit 51d7ee3493
2 changed files with 9 additions and 3 deletions

View File

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

View File

@ -101,7 +101,7 @@ namespace stdex
return;
}
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)) {
assert(count_src < INT_MAX || count_src == SIZE_MAX);
// Try to convert to stack buffer first.
@ -124,7 +124,7 @@ namespace stdex
throw std::runtime_error("MultiByteToWideChar failed");
}
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)) {
assert(count_src < INT_MAX || count_src == SIZE_MAX);
// Try to convert to stack buffer first.
@ -147,7 +147,7 @@ namespace stdex
throw std::runtime_error("WideCharToMultiByte failed");
}
if constexpr (sizeof(T_from) == sizeof(char) && sizeof(T_to) == sizeof(char)) {
if _Constexpr_ (sizeof(T_from) == sizeof(char) && sizeof(T_to) == sizeof(char)) {
assert(count_src < INT_MAX || count_src == SIZE_MAX);
// Try to convert to stack buffer first.