diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-06-26 17:36:36 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-06-26 17:36:36 +0100 |
commit | 88850fadb5d5c3bce5ca2959b81cca1cd067c8ca (patch) | |
tree | 882ee35f0268175141be185f2655f27571abe788 | |
parent | Get the target schema name (diff) | |
download | mygrate-88850fadb5d5c3bce5ca2959b81cca1cd067c8ca.tar.bz2 mygrate-88850fadb5d5c3bce5ca2959b81cca1cd067c8ca.tar.xz mygrate-88850fadb5d5c3bce5ca2959b81cca1cd067c8ca.zip |
General purpose optional stream<<
-rw-r--r-- | test/helpers.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/helpers.h b/test/helpers.h index 107eda5..59ae18d 100644 --- a/test/helpers.h +++ b/test/helpers.h @@ -4,6 +4,8 @@ #include <concepts> #include <cstddef> #include <ctime> +#include <iostream> +#include <optional> inline constexpr std::byte operator""_b(const unsigned long long hex) { @@ -24,6 +26,18 @@ namespace std { { return to_integer<T>(b) != i; } + + template<typename T> + ostream & + operator<<(ostream & s, const std::optional<T> & o) + { + if (o) { + return s << *o; + } + else { + return s << "-"; + } + } } inline struct tm |