Skip to content

Conversation

@vinniefalco
Copy link
Member

This helper function assists models of the ReadSource concept by handling iteration over a mutable buffer sequence and invoking a user-provided function for each buffer.

The implementation follows the pattern used in any_read_source::read() and provides special EOF handling: when EOF occurs after reading some bytes, it returns success with the byte count instead of propagating the EOF error.

Fixes #59

Generated with Claude Code

This helper function assists models of the ReadSource concept by
handling iteration over a mutable buffer sequence and invoking a
user-provided function for each buffer. The function integrates
the results and properly handles error::eof.

The implementation follows the pattern used in any_read_source::read()
and provides special EOF handling: when EOF occurs after reading some
bytes, it returns success with the byte count instead of propagating
the EOF error.

Fixes #59

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Vinnie Falco <vinniefalco@users.noreply.github.com>

if(ec_tmp.failed())
{
if(ec_tmp == error::eof && total > 0)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude
zero bytes and error::eof is ok, it can happen with empty files and empty content bodies

Copy link

@claude claude bot Nov 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude finished @vinniefalco's task —— View job


Acknowledgment

Understood! The current implementation correctly handles both cases:

  1. EOF with total > 0: Returns success with the accumulated byte count (line 160-165)
  2. EOF with total == 0: Propagates the EOF error (line 166-168)

This allows empty files and empty content bodies to properly signal EOF on the first read with zero bytes, which is the expected behavior for these cases.


@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://63.buffers.prtest.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2025-11-30 06:01:47 UTC

@vinniefalco vinniefalco marked this pull request as draft December 1, 2025 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

helper for single-buffer algorithms

3 participants