13concept OstreamFormattable =
14 requires (
const T& t, std::ostream& os)
16 { t.template format<std::ostream>(os) } -> std::same_as<void>;
23 requires OstreamFormattable<T>
24std::ostream&
operator<<(std::ostream& os,
const T& value)
26 value.template format<std::ostream>(os);
45concept NotBufferLike =
46 !std::is_base_of_v<Buffer, std::remove_reference_t<S>>;
54 // std::ostream-like: write(const char*, streamsize)
55 s.write(static_cast<const char*>(nullptr), 0);
59 // byte-sink-like: write(const void*, size_t)
60 s.write(static_cast<const void*>(nullptr), std::size_t{});
64template<typename T, typename S>
66 requires (const T& t, S& s)
68 { t.template format<S>(s) } -> std::same_as<void>;
74template<typename Stream, typename T>
75 requires NotBufferLike<Stream> && StreamLike<Stream> &&
76 FormatsWith<T, Stream>
77Stream& operator<<(Stream& s, const T& value)
79 value.template format<Stream>(s);
83} // namespace clarisma
Buffer & operator<<(Buffer &buf, std::string_view s)
Definition Buffer.h:198