summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-06-17 19:51:52 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-06-17 19:51:52 +0100
commitd69dab7433f8215aed78eddcb8244ceda2381ab6 (patch)
tree800df324eccfba038db956f8e5fd1c0300789fe1
parentMark failing branch of verify unlikely (diff)
downloadmygrate-d69dab7433f8215aed78eddcb8244ceda2381ab6.tar.bz2
mygrate-d69dab7433f8215aed78eddcb8244ceda2381ab6.tar.xz
mygrate-d69dab7433f8215aed78eddcb8244ceda2381ab6.zip
Add wrapper for writing a DbValueV to a stream
-rw-r--r--lib/dbTypes.cpp19
-rw-r--r--lib/dbTypes.h4
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/dbTypes.cpp b/lib/dbTypes.cpp
new file mode 100644
index 0000000..7a428ae
--- /dev/null
+++ b/lib/dbTypes.cpp
@@ -0,0 +1,19 @@
+#include "dbTypes.h"
+
+namespace std {
+ struct write {
+ template<typename T>
+ std::ostream &
+ operator()(const T & v) const
+ {
+ return strm << v;
+ }
+ std::ostream & strm;
+ };
+
+ std::ostream &
+ operator<<(std::ostream & strm, const MyGrate::DbValueV & v)
+ {
+ return std::visit(write {strm}, v);
+ }
+}
diff --git a/lib/dbTypes.h b/lib/dbTypes.h
index 332b896..0b7185c 100644
--- a/lib/dbTypes.h
+++ b/lib/dbTypes.h
@@ -131,4 +131,8 @@ namespace MyGrate {
};
}
+namespace std {
+ std::ostream & operator<<(std::ostream & strm, const MyGrate::DbValueV & v);
+}
+
#endif