summaryrefslogtreecommitdiff
path: root/src/util/basic_macros.h
diff options
context:
space:
mode:
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