summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorancarola <raffaele.ancarola@epfl.ch>2019-01-23 23:47:35 +0100
committerancarola <raffaele.ancarola@epfl.ch>2019-01-23 23:47:35 +0100
commitbde7d445271fd9b4850f113707313e1faef13354 (patch)
treebe6973d84968046a08a351edd012340cff0d1625
parentj (diff)
parentFix _np::inspect in release mode (diff)
downloadflatland-bde7d445271fd9b4850f113707313e1faef13354.tar.gz
flatland-bde7d445271fd9b4850f113707313e1faef13354.zip
Merge remote-tracking branch 'nao/master'
Bene bene
-rw-r--r--lib/include/debug.hpp48
m---------lib/libwrapsdl20
2 files changed, 48 insertions, 0 deletions
diff --git a/lib/include/debug.hpp b/lib/include/debug.hpp
new file mode 100644
index 0000000..fd90500
--- /dev/null
+++ b/lib/include/debug.hpp
@@ -0,0 +1,48 @@
+#pragma once
+
+#ifdef DEBUG
+#include <iostream>
+#include <sstream>
+
+#define __FILENAME__ (\
+ __builtin_strrchr(__FILE__, '/') ? \
+ __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
+
+#define npdebug(...); { \
+ std::cerr << "[" << __FILENAME__ \
+ << ":" << __LINE__ \
+ << ", " << __func__ \
+ << "] " ; \
+ _np::debug(__VA_ARGS__); \
+}
+
+#define npinspect(...); _np::inspect(__VA_ARGS__);
+
+namespace _np {
+ template<typename... Args>
+ inline void debug(const Args&... args) {
+ (std::cerr << ... << args) << std::endl;
+ }
+
+ template<typename Msg, typename Expr, typename... Args>
+ inline T& inspect(const Msg& msg, Expr& expr, const Args&... args) {
+ npdebug(msg, expr, args);
+ return expr;
+ }
+}
+
+#else
+
+#define npdebug(...); {}
+#define npinspect(...); {}
+
+namespace _np {
+ template<typename.. Args>
+ void debug(Args&... args) {}
+
+ template<typename Msg, typename Expr, typename... Args>
+ inline T& inspect(const Msg& msg, Expr& expr, const Args&... args) {
+ return expr;
+ }
+}
+#endif
diff --git a/lib/libwrapsdl2 b/lib/libwrapsdl2
deleted file mode 160000
-Subproject 66bb51fa6148d6910da054bacd4fcbd2fa7b5ba