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

Replace boost::filter_iterator with explicit iterator implementation #2312

Merged
merged 1 commit into from
Jul 27, 2023

Conversation

nvmkuruc
Copy link
Collaborator

Description of Change(s)

Converts the _Predicate private class into an explicit _FilterIterator bidirectional iterator implementation.

Fixes Issue(s)

  • I have verified that all unit tests pass with the proposed changes
  • I have submitted a signed Contributor License Agreement

@tallytalwar
Copy link
Contributor

Filed as internal issue #USD-8056

const _Owner* _owner;
void filter()
{
while (_underlyingIterator != _end &&

Choose a reason for hiding this comment

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

I'm pretty sure you have this inverted. According to the boost filter_iterator documentation, the iterator retains the element if the predicate returns true and skips the element if the predicate is false. Here, you're skipping when the predicate is true.

Copy link
Collaborator Author

@nvmkuruc nvmkuruc Jul 11, 2023

Choose a reason for hiding this comment

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

That was it. All tests are now passing.


bool operator()(const value_type& x) const
private:
// Skip any iterators that don't satisfy the predicate

Choose a reason for hiding this comment

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

These shouldFilter and filter functions aren't here for API conformance right? If I'm right, they should follow our coding conventions for private methods, i.e. capitalized and starting with an underscore

using pointer = typename _InnerIterator::pointer;
using difference_type = typename _InnerIterator::difference_type;

_FilterIterator() = default;

Choose a reason for hiding this comment

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

The body of all three of these should be on a new line like you did for all the rest of the functions.

@pixar-oss pixar-oss merged commit 0104473 into PixarAnimationStudios:dev Jul 27, 2023
@nvmkuruc nvmkuruc deleted the sdffilteriterator branch December 29, 2023 03:12
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.

4 participants