Skip to content

wrire_sink design #83

@vinniefalco

Description

@vinniefalco

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions