summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/stream_support.cpp11
-rw-r--r--lib/stream_support.hpp6
2 files changed, 4 insertions, 13 deletions
diff --git a/lib/stream_support.cpp b/lib/stream_support.cpp
deleted file mode 100644
index 2054873..0000000
--- a/lib/stream_support.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "stream_support.hpp"
-
-#include <array>
-#include <vector>
-
-static_assert(spanable<std::vector<int>>);
-// static_assert(spanable<std::vector<char>>);
-static_assert(spanable<std::array<int, 1>>);
-// static_assert(spanable<std::array<char, 1>>);
-static_assert(!spanable<std::string>);
-static_assert(!spanable<std::string_view>);
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 <sstream>
#include <type_traits>
+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> && !
-std::is_same_v<char, std::decay_t<typename T::value_type>>;
+stringlike<T> && !std::is_same_v<std::span<typename T::value_type>, T>;
namespace std {
template<typename T, std::size_t L>
std::ostream &
- operator<<(std::ostream & s, const span<const T, L> v)
+ operator<<(std::ostream & s, const span<T, L> v)
{
s << '(';
for (const auto & i : v) {