summaryrefslogtreecommitdiff
path: root/lib/stream_support.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-02-24 01:28:14 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2025-02-24 01:28:14 +0000
commitef08a08617a1541d8aa1862d8bcfe049dcb57998 (patch)
treeabfcb0e0146a29deead395b0a730acaf8b01dc47 /lib/stream_support.h
parentMerge branch 'terrain-deform-2' (diff)
parentNew hardcoded test rail network (diff)
downloadilt-ef08a08617a1541d8aa1862d8bcfe049dcb57998.tar.bz2
ilt-ef08a08617a1541d8aa1862d8bcfe049dcb57998.tar.xz
ilt-ef08a08617a1541d8aa1862d8bcfe049dcb57998.zip
Merge remote-tracking branch 'origin/terrain-for-networks'
Diffstat (limited to 'lib/stream_support.h')
-rw-r--r--lib/stream_support.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/stream_support.h b/lib/stream_support.h
index f21622a..5f276fd 100644
--- a/lib/stream_support.h
+++ b/lib/stream_support.h
@@ -4,6 +4,7 @@
#include <glm/glm.hpp>
#include <iostream>
#include <maths.h>
+#include <optional>
#include <source_location>
#include <span>
#include <sstream>
@@ -82,6 +83,16 @@ namespace std {
{
return s << EnumTypeDetails<E>::typeName << "::" << EnumDetails<E>::to_string(e).value();
}
+
+ template<typename T>
+ inline std::ostream &
+ operator<<(std::ostream & s, const std::optional<T> & v)
+ {
+ if (v) {
+ return s << *v;
+ }
+ return s << "nullopt";
+ }
}
template<typename T>
@@ -104,3 +115,4 @@ namespace {
}
#define CLOG(x) clogImpl(x, #x)
+#define CLOGf(...) clogImpl(std::format(__VA_ARGS__), "msg")