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

fix: arrayElement overloads failing with non-arithmetic iterators #839

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

eric-bodhi
Copy link
Contributor

arrayElement(start, end) overloads would fail when being used with bidrectional iterators or basically anything that wasnt a random_access_iterator, so I added overloads for both random_access_iterator's and every other form.
Since random_access supports arithmetic we can just access index, but since every other iterator doesn't support we need to hand roll to the index.

Even before I rewrote the function yesterday it still would've failed on list containers or non-random_access iterators.

@eric-bodhi
Copy link
Contributor Author

Algo seems to be passing over range twice...

@cieslarmichal cieslarmichal merged commit 5497206 into cieslarmichal:main Aug 1, 2024
15 checks passed
@eric-bodhi
Copy link
Contributor Author

No, I was gonna say the algo was multi-passing and being inefficient, there's a single pass algorithm that's more elegant here.

@eric-bodhi eric-bodhi deleted the bugfix branch August 2, 2024 18:35
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.

2 participants