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

Added iterator_adaptor, refactored pointer_iterator #62

Merged
merged 5 commits into from
Apr 5, 2024

Conversation

JohanMabille
Copy link
Collaborator

This will make it easier to create other iterator adaptors.

Copy link
Collaborator

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

LGTM modulo a suggestion and a question.

I do not see the how pointer_iterator is going to be used for now but I guess I will once adaptations are made.

Comment on lines +494 to +496
template <class T>
class pointer_iterator;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this declaration needed since the class is defined hereinafter?

Suggested change
template <class T>
class pointer_iterator;

Copy link
Collaborator

Choose a reason for hiding this comment

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

I tested the removal locally and this is actually required for reasons I am trying to understand.

Copy link
Collaborator Author

@JohanMabille JohanMabille Apr 5, 2024

Choose a reason for hiding this comment

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

So actually this is a way to limit the definition of the pointer_iterator class to pointer template parameters:

  • declare the class but do not implement it in the general case
  • define the class for the T* specialization.

Copy link
Collaborator

Choose a reason for hiding this comment

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

As discussed IRL, we could define a concept to restrict the definition to pointers.

Comment on lines 513 to 515
template <class Iter>
requires std::same_as<Iter, std::remove_const_t<T>>
pointer_iterator(const Iter& iter)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the template type parameter Iter used to ease the signature instead of using a iterator_adaptor?

Copy link
Collaborator Author

@JohanMabille JohanMabille Apr 5, 2024

Choose a reason for hiding this comment

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

This was supposed to allow to build a pointer_iterator<const T*> from a T*. But we're missing the pointer_iterator<T*> => pointer_iterator<const T*>, but the name Iter is confusing, and the implementation ifs wrong :s

@JohanMabille JohanMabille merged commit ee9389a into man-group:main Apr 5, 2024
20 checks passed
@JohanMabille JohanMabille deleted the iterator_adaptor branch April 5, 2024 13:08
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.

3 participants