0
0
mirror of https://github.com/nemtrif/utfcpp.git synced 2026-01-18 17:11:21 +01:00

Another attempt at UTF_CPP_STATIC_ASSERT for C++ 98/03

This commit is contained in:
nemtrif
2025-09-27 16:46:42 -04:00
parent b7679e67ff
commit 961e7a3e9b

View File

@@ -48,9 +48,9 @@ DEALINGS IN THE SOFTWARE.
#define UTF_CPP_OVERRIDE
#define UTF_CPP_NOEXCEPT throw()
// Simulate static_assert:
template <bool Condition> struct StaticAssert {static void utf8_static_assert() {int static_assert_impl[Condition ? 1 : -1]; } };
template <> struct StaticAssert<true> {static void utf8_static_assert() {}};
#define UTF_CPP_STATIC_ASSERT(condition) StaticAssert<condition>::utf8_static_assert();
template<bool> struct UtfCppCompileTimeAssert;
template<> struct UtfCppCompileTimeAssert <true> { };
#define UTF_CPP_STATIC_ASSERT(condition) (UtfCppCompileTimeAssert <(condition) != 0>())
#endif // C++ 11 or later