Skip to content

More fixes for iterators-are-pointers case#24278

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
georgthegreat:compat-fixes
Sep 18, 2023
Merged

More fixes for iterators-are-pointers case#24278
asmorkalov merged 1 commit intoopencv:4.xfrom
georgthegreat:compat-fixes

Conversation

@georgthegreat
Copy link
Copy Markdown
Contributor

This continues #24232.

for (i = contours.begin(); i != contours.end(); ++i)
for (size_t i = 0; i < contours.size(); ++i)
{
const iter_t::difference_type idx = i - contours.begin();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Raw pointers have no ::difference_type member typedef (due to not having members at all).
One could use std::iterator_traits to get one, by I have simplified to code instead.

Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍

@asmorkalov asmorkalov self-assigned this Sep 18, 2023
@asmorkalov asmorkalov added this to the 4.9.0 milestone Sep 18, 2023
@asmorkalov asmorkalov merged commit 0a53afe into opencv:4.x Sep 18, 2023
@georgthegreat georgthegreat deleted the compat-fixes branch September 26, 2023 20:04
@asmorkalov asmorkalov mentioned this pull request Sep 28, 2023
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.

2 participants