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:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user