KEMBAR78
Use `std::iterator_traits` to extract `iterator_category` by Mike-Leo-Smith · Pull Request #3544 · nlohmann/json · GitHub
Skip to content

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.
@Mike-Leo-Smith Mike-Leo-Smith requested a review from nlohmann as a code owner June 18, 2022 09:04
@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 Mike-Leo-Smith requested a review from nlohmann June 18, 2022 15:51
@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