Skip to content

✨ Add byterator::advance#225

Merged
elbeno merged 1 commit intointel:mainfrom
elbeno:byterator-advance
May 8, 2025
Merged

✨ Add byterator::advance#225
elbeno merged 1 commit intointel:mainfrom
elbeno:byterator-advance

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