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

Enhance move_first and move_next semantics #4

Open
timothy-shields opened this issue Jun 27, 2013 · 0 comments
Open

Enhance move_first and move_next semantics #4

timothy-shields opened this issue Jun 27, 2013 · 0 comments
Assignees

Comments

@timothy-shields
Copy link
Owner

The Enumerator<T> concept currently prescribes the following usage pattern:

  1. zero or one move_first
    • if zero move_first, done
    • else if one move_first and false, done
    • else one move_first and true, proceed to (2)
  2. zero or more current
  3. zero or one move_next
    • if zero move_next, done
    • if one move_next and false, done
    • else one move_next and true, proceed to (2)

The Enumerator<T> concept should prescribe the following usage pattern:

  1. zero or one move_first
    • if zero move_first, done
    • else if one move_first and false, zero or more move_next (all returning false) then done
    • else one move_first and true, proceed to (2)
  2. zero or more current
  3. zero or one move_next
    • if zero move_next, done
    • if one move_next and false, zero or more move_next (all returning false) then done
    • else one move_next and true, proceed to (2)

This differs from the previous semantics, which forbid calling move_next any more after having gotten a false return from move_first or move_next. That previous restriction imposed by the semantics was both unnecessary and (it turns out) inconvenient. Operations like merge, union, intersect, except, etc. can be implemented with less state if this restriction is relaxed.

@ghost ghost assigned timothy-shields Jun 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant