boost::capy::Stream
Concept for types providing both read and write operations.
Synopsis
Declared in <boost/capy/concept/stream.hpp>
template<typename T>
concept Stream = ReadStream<T> && WriteStream<T>;
Description
A type satisfies Stream if it satisfies both ReadStream and WriteStream.
Semantic Requirements
The semantics are the union of ReadStream and WriteStream. The stream supports bidirectional I/O through read_some and write_some operations.
Example
template<Stream S>
task<> echo(S& stream)
{
char buf[1024];
auto [ec, n] = co_await stream.read_some(mutable_buffer(buf));
if(ec)
co_return;
co_await stream.write_some(const_buffer(buf, n));
}
See Also
ReadStream, WriteStream
Created with MrDocs