summaryrefslogtreecommitdiff
path: root/lib/stream_support.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stream_support.h')
-rw-r--r--lib/stream_support.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/stream_support.h b/lib/stream_support.h
index fa536f1..57d82a1 100644
--- a/lib/stream_support.h
+++ b/lib/stream_support.h
@@ -11,17 +11,16 @@
template<typename S>
concept stringlike = requires(const S & s) { s.substr(0); };
template<typename T>
-concept spanable = std::is_constructible_v<std::span<const typename T::value_type>, T> && !stringlike<T>
- && !std::is_same_v<std::span<typename T::value_type>, T>;
+concept NonStringIterableCollection
+ = std::is_same_v<decltype(std::declval<T>().begin()), decltype(std::declval<T>().end())> && !stringlike<T>;
namespace std {
- template<typename T, std::size_t L>
std::ostream &
- operator<<(std::ostream & s, const span<T, L> v)
+ operator<<(std::ostream & s, const NonStringIterableCollection auto & v)
{
s << '(';
for (const auto & i : v) {
- if (&i != &v.front()) {
+ if (&i != &*v.begin()) {
s << ", ";
}
s << i;
@@ -43,13 +42,6 @@ namespace std {
return (s << std::span {&v[0], L});
}
- template<spanable T>
- std::ostream &
- operator<<(std::ostream & s, const T & v)
- {
- return (s << std::span {v});
- }
-
template<typename First, typename Second>
std::ostream &
operator<<(std::ostream & s, const std::pair<First, Second> & v)