summaryrefslogtreecommitdiff
path: root/src/debug/static_assert.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-07-06 21:43:30 +0300
committerAndrei Karas <akaras@inbox.ru>2017-07-06 21:43:30 +0300
commit2a2c966fd92a3d9c476d81941383b728427c2c37 (patch)
tree5075e0cf508b8a7212cce1534847964fbecd217f /src/debug/static_assert.h
parentb4531dc7d03b73592cbb4356ab90749501c6ca36 (diff)
downloadplus-2a2c966fd92a3d9c476d81941383b728427c2c37.tar.gz
plus-2a2c966fd92a3d9c476d81941383b728427c2c37.tar.bz2
plus-2a2c966fd92a3d9c476d81941383b728427c2c37.tar.xz
plus-2a2c966fd92a3d9c476d81941383b728427c2c37.zip
Update debug libs from https://github.com/adah1972/nvwa
Diffstat (limited to 'src/debug/static_assert.h')
-rw-r--r--src/debug/static_assert.h35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/debug/static_assert.h b/src/debug/static_assert.h
index 04833d844..49248611d 100644
--- a/src/debug/static_assert.h
+++ b/src/debug/static_assert.h
@@ -2,7 +2,7 @@
// vim:tabstop=4:shiftwidth=4:expandtab:
/*
- * Copyright (C) 2004-2008 Wu Yongwei <adah at users dot sourceforge dot net>
+ * Copyright (C) 2004-2013 Wu Yongwei <adah at users dot sourceforge dot net>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
@@ -24,30 +24,39 @@
* This file is part of Stones of Nvwa:
* http://sourceforge.net/projects/nvwa
*
- * original version changed for ManaPlus
- *
- * Copyright (C) 2011-2017 The ManaPlus Developers
*/
/**
- * @file static_assert.h
- *
- * Template class to check validity during compilation time (adapted from Loki).
+ * @file static_assert.h
*
- * @version 1.2, 2005/11/22
- * @author Wu Yongwei
+ * Template class to check validity duing compile time (adapted from Loki).
*
+ * @date 2013-09-07
*/
#ifndef STATIC_ASSERT
-template <bool> struct __nvwa_compile_time_error;
-template <> struct __nvwa_compile_time_error<true> {};
+#include "debug/c++11.h"
+
+#if HAVE_CXX11_STATIC_ASSERT
+
+#define STATIC_ASSERT(_Expr, _Msg) static_assert(_Expr, #_Msg)
+
+#else
+
+namespace nvwa {
+
+template <bool> struct compile_time_error;
+template <> struct compile_time_error<true> {};
#define STATIC_ASSERT(_Expr, _Msg) \
{ \
- __nvwa_compile_time_error<((_Expr) != 0)> ERROR_##_Msg; \
+ nvwa::compile_time_error<((_Expr) != 0)> ERROR_##_Msg; \
(void)ERROR_##_Msg; \
}
-#endif // STATIC_ASSERT
+}
+
+#endif // HAVE_CXX11_STATIC_ASSERT
+
+#endif // STATIC_ASSERT