From 69acdf6584be2a04094e27b395c50c071b2b15cf Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 28 Dec 2022 13:49:54 +0000 Subject: Use the existence of .substr(...) to test if a T is stringlike --- lib/stream_support.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/stream_support.hpp') diff --git a/lib/stream_support.hpp b/lib/stream_support.hpp index 5f45cbf..a3565d8 100644 --- a/lib/stream_support.hpp +++ b/lib/stream_support.hpp @@ -8,14 +8,16 @@ #include #include +template +concept stringlike = requires(const S & s) { s.substr(0); }; template concept spanable = std::is_constructible_v, T> && ! -std::is_same_v>; +stringlike && !std::is_same_v, T>; namespace std { template std::ostream & - operator<<(std::ostream & s, const span v) + operator<<(std::ostream & s, const span v) { s << '('; for (const auto & i : v) { -- cgit v1.2.3