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

Add CoordinateSequenceIterator #685

Merged
merged 1 commit into from
Sep 21, 2022
Merged

Conversation

dbaston
Copy link
Member

@dbaston dbaston commented Sep 20, 2022

This adds an iterator to CoordinateSequence so that class can be used with STL algortithms

std::sort(seq.begin(), seq.end());

and range for loops,

    for (auto& coord : seq_) {
        coord.y = 2*coord.x;
    }

    // Use const iterator to check values
    std::size_t i = 0;
    for (const auto& coord : seq_) {
        ensure_equals(coord.x, static_cast<double>(i));
        ensure_equals(coord.y, 2*coord.x);
        i++;
    }

This does not reduce the overhead of virtual Coordinate access; that requires #674 .

@dbaston dbaston added the Enhancement New feature or feature improvement. label Sep 20, 2022
@dbaston dbaston merged commit 8bb8356 into libgeos:main Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or feature improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant