From 0f03a7e40d681009ebbd1075306e06fed8443277 Mon Sep 17 00:00:00 2001 From: yaito3014 Date: Wed, 4 Mar 2026 19:05:35 +0900 Subject: [PATCH] Constrain `operator<<` --- include/iris/alloy/io.hpp | 3 +++ test/alloy/alloy.cpp | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/include/iris/alloy/io.hpp b/include/iris/alloy/io.hpp index 13175be17..f619bd7bb 100644 --- a/include/iris/alloy/io.hpp +++ b/include/iris/alloy/io.hpp @@ -9,6 +9,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ +#include + #include #include @@ -40,6 +42,7 @@ struct tuple_ostream_impl> } // detail template + requires std::conjunction_v...> std::ostream& operator<<(std::ostream& os, tuple const& t) { return detail::tuple_ostream_impl>::apply(os, t); diff --git a/test/alloy/alloy.cpp b/test/alloy/alloy.cpp index 80e79fa93..9062edb92 100644 --- a/test/alloy/alloy.cpp +++ b/test/alloy/alloy.cpp @@ -7,6 +7,8 @@ #include +#include + #include #include @@ -499,6 +501,13 @@ TEST_CASE("utility") TEST_CASE("io") { + { + STATIC_CHECK(iris::req::ADL_ostreamable_v>); + + struct NotStreamable {}; + STATIC_CHECK(!iris::req::ADL_ostreamable_v); + STATIC_CHECK(!iris::req::ADL_ostreamable_v>); + } { { std::stringstream ss;