Skip to content

Use std::iterator_traits to extract iterator_category - #3544

Merged
nlohmann merged 2 commits into
nlohmann:developfrom
Mike-Leo-Smith:patch-1
Jun 18, 2022
Merged

nlohmann merged 2 commits into
nlohmann:developfrom
Mike-Leo-Smith:patch-1

Conversation

@Mike-Leo-Smith

Copy link
Copy Markdown
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

coveralls commented Jun 18, 2022 •

Copy link
Copy Markdown

Coverage Status

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

@nlohmann nlohmann left a comment

Copy link
Copy Markdown
Owner

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
Copy Markdown
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.

@falbrechtskirchinger falbrechtskirchinger left a comment

Copy link
Copy Markdown
Contributor

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 left a comment

Copy link
Copy Markdown
Owner

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
Copy Markdown
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

⌂ 换网址