Skip to content
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

peek_back #187

Open
Mortal opened this issue Jun 8, 2015 · 1 comment · May be fixed by #261
Open

peek_back #187

Mortal opened this issue Jun 8, 2015 · 1 comment · May be fixed by #261

Comments

@Mortal
Copy link
Collaborator

Mortal commented Jun 8, 2015

Right now, TPIE streams support forward read/can_read, forward peek/can_peek/skip, backward read_back/can_read_back.

In my application, I need peek/skip backwards, so I implement it using this workaround:

bool canPeek; T peekItem;
// initialization skip macro:
canPeek = fs.can_read_back();
if (canPeek) peekItem = fs.read_back();

while (canPeek && peekItem.useful()) {
    // Use peekItem ...
    // skip macro:
    canPeek = fs.can_read_back();
    if (canPeek) peekItem = fs.read_back();
}

I request this being possible in file_stream. (I'm not sure if it's a reasonable request -- it's been a while since I've meddled with its implementation.)

@SSoelvsten
Copy link
Contributor

SSoelvsten commented Jul 25, 2022

I have the very same workaround inside of my BDD library. Hence, I would be interested (if possible) that this 7 year old issue was looked at again.

I'm open to give it a shot myself.

@SSoelvsten SSoelvsten linked a pull request Jul 27, 2022 that will close this issue
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 a pull request may close this issue.

2 participants