Skip to content

✨ Add byterator::advance #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged

✨ Add byterator::advance #225

merged 1 commit into from
May 8, 2025

Conversation

elbeno
Copy link
Contributor

@elbeno elbeno commented May 8, 2025

Problem:

  • Sometimes we want to advance a byterator, particularly by the size of a type, and it's annoying to have to discard the result of read (which is marked [[nodiscard]]).

Solution:

  • Implement advance and advanceuXX functions on byterator.

Note:

  • It's also possible to use std::advance. But the advanceuXX functions match their peek, read and write counterparts.

Problem:
- Sometimes we want to advance a `byterator`, particularly by the size of a type,
  and it's annoying to have to discard the result of `read` (which is marked
  `[[nodiscard]]`).

Solution:
- Implement `advance` and `advanceuXX` functions on `byterator`.

Note:
- It's also possible to use `std::advance`. But the `advanceuXX` functions match
  their `peek`, `read` and `write` counterparts.
@elbeno
Copy link
Contributor Author

elbeno commented May 8, 2025

@jvillavc you can use these functions to advance instead of the read functions (which are marked [[nodiscard]])

@elbeno elbeno enabled auto-merge May 8, 2025 22:08
Copy link
Contributor

@mjcaisse-intel mjcaisse-intel left a comment

Choose a reason for hiding this comment

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

Nice addition

@elbeno elbeno merged commit a95b340 into intel:main May 8, 2025
42 checks passed
@elbeno elbeno deleted the byterator-advance branch May 15, 2025 21:48
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.

2 participants