The current requirements for WriteSink are
struct write_sink
{
void size_hint( std::size_t );
template< class Buffers >
system::error_code write( Buffers const&, bool finished );
system::error_code finish();
};
There is some friction here. First, size_hint is not called when the size is unknown, which is a pessimization. It would be better for this function call to be required and explicit:
void size_hint( optional<std::size_t> );
This way write doesn't need stateful logic to know that size_hint wasn't called in the case where the size is unknown.
Also, the buffer sequence requirement implies that write is always a template. Or that we need a perfect type-erasing wrapper. Neither of these are particularly satisfying.
The current requirements for WriteSink are
There is some friction here. First,
size_hintis not called when the size is unknown, which is a pessimization. It would be better for this function call to be required and explicit:This way
writedoesn't need stateful logic to know thatsize_hintwasn't called in the case where the size is unknown.Also, the buffer sequence requirement implies that
writeis always a template. Or that we need a perfect type-erasing wrapper. Neither of these are particularly satisfying.