summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/stream_support.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/stream_support.h b/lib/stream_support.h
index 57d82a1..d71356c 100644
--- a/lib/stream_support.h
+++ b/lib/stream_support.h
@@ -6,6 +6,7 @@
#include <maths.h>
#include <span>
#include <sstream>
+#include <tuple>
#include <type_traits>
template<typename S>
@@ -49,6 +50,22 @@ namespace std {
return (s << '(' << v.first << ", " << v.second << ')');
}
+ namespace {
+ template<typename... T, size_t... Idx>
+ std::ostream &
+ printTuple(std::ostream & s, const std::tuple<T...> & v, std::integer_sequence<size_t, Idx...>)
+ {
+ return ((s << (Idx ? ", " : "") << std::get<Idx>(v)), ...);
+ }
+ }
+
+ template<typename... T>
+ std::ostream &
+ operator<<(std::ostream & s, const std::tuple<T...> & v)
+ {
+ return printTuple(s << '{', v, std::make_index_sequence<sizeof...(T)>()) << '}';
+ }
+
inline std::ostream &
operator<<(std::ostream & s, const Arc & arc)
{