summaryrefslogtreecommitdiff
path: root/src/util/basic_macros.h
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
committerShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
commitcaecdb681c428c1aab9c0f7eec2570c0460f995c (patch)
treee5115982ea59bbf2343ba9b35bc4a0cfbb56f407 /src/util/basic_macros.h
parent81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (diff)
parent80dc961d24e1964e25d57039ddb2ba639f9f4d22 (diff)
downloadminetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.gz
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.bz2
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.zip
Merge 0.4.16 into stable-0.4
Diffstat (limited to 'src/util/basic_macros.h')
-rw-r--r--src/util/basic_macros.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/util/basic_macros.h b/src/util/basic_macros.h
index c100b4f25..687d7cf85 100644
--- a/src/util/basic_macros.h
+++ b/src/util/basic_macros.h
@@ -20,14 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef BASICMACROS_HEADER
#define BASICMACROS_HEADER
-#include <algorithm>
-
#define ARRLEN(x) (sizeof(x) / sizeof((x)[0]))
#define MYMIN(a, b) ((a) < (b) ? (a) : (b))
#define MYMAX(a, b) ((a) > (b) ? (a) : (b))
+// Requires <algorithm>
#define CONTAINS(c, v) (std::find((c).begin(), (c).end(), (v)) != (c).end())
// To disable copy constructors and assignment operations for some class
@@ -50,4 +49,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define STATIC_ASSERT(expr, msg) \
UNUSED_ATTRIBUTE typedef char msg[!!(expr) * 2 - 1]
+// Macros to facilitate writing position vectors to a stream
+// Usage:
+// v3s16 pos(1,2,3);
+// mystream << "message " << PP(pos) << std::endl;
+
+#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
+
+#define PP2(x) "("<<(x).X<<","<<(x).Y<<")"
+
#endif