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

transform_iterator end iterator with non-default-constructible unary function #57

Open
Kojoley opened this issue May 24, 2020 · 1 comment

Comments

@Kojoley
Copy link
Contributor

Kojoley commented May 24, 2020

Currently one have to construct/copy a second copy of transformation function for an end iterator what is unwanted and seems to be omission of the library design. For example, Boost.Range solves it via wrapping user functor with optional, unfortunately.

@Lastique
Copy link
Member

Omitting the function object for an end iterator seems like a useful optimization, but the problem is that the end iterator can be made a non-end iterator by decrementing, and then the transform_iterator is expected to work.

I suppose, we could add a new factory function and create a specialized version of transform_iterator for an "end" iterator that will simply abort in runtime on increments, decrements and dereference. Unfortunately, this won't be caught at compile time as the respective operators need to be callable so that the iterator category is still correctly detected by the concepts.

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

No branches or pull requests

2 participants