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

Use std::iterator_traits to extract iterator_category #3544

Merged
merged 2 commits into from
Jun 18, 2022

Conversation

Mike-Leo-Smith
Copy link
Contributor

In third-party STL implementations, array_t::iterator might be a pointer (e.g., vector in EASTL) rather than a class, in which case directly using array_t::iterator::iterator_category is invalid. This commit fixes it with std::iterator_traits, which handles pointers correctly.

In third-party STL implementations, `array_t::iterator` might be a pointer (e.g., `vector` in [EASTL](https://github.com/electronicarts/EASTL)) rather than a class, in which case directly using `array_t::iterator::iterator_category` is invalid. This commit fixes it with `std::iterator_traits`, which handles pointers correctly.
@coveralls
Copy link

coveralls commented Jun 18, 2022

Coverage Status

Coverage remained the same at 100.0% when pulling 40ed99d on Mike-Leo-Smith:patch-1 into f6acdbe on nlohmann:develop.

Copy link
Owner

@nlohmann nlohmann left a comment

Choose a reason for hiding this comment

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

Please run make amalgamate to also add the changes to the single-header version, single_include/json.hpp.

@Mike-Leo-Smith
Copy link
Contributor Author

Please run make amalgamate to also add the changes to the single-header version, single_include/json.hpp.

Thanks for the instructions. Should be good now.

Copy link
Contributor

@falbrechtskirchinger falbrechtskirchinger left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Owner

@nlohmann nlohmann left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@nlohmann nlohmann self-assigned this Jun 18, 2022
@nlohmann nlohmann added this to the Release 3.11.0 milestone Jun 18, 2022
@nlohmann nlohmann merged commit 87cda1d into nlohmann:develop Jun 18, 2022
@nlohmann
Copy link
Owner

Thanks!

@Mike-Leo-Smith Mike-Leo-Smith deleted the patch-1 branch June 18, 2022 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants