Skip to content

Comments

add assignment operator to int_vector_buffer iterator#364

Open
niklasb wants to merge 3 commits intosimongog:masterfrom
niklasb:int_vector_buffer-iterator
Open

add assignment operator to int_vector_buffer iterator#364
niklasb wants to merge 3 commits intosimongog:masterfrom
niklasb:int_vector_buffer-iterator

Conversation

@niklasb
Copy link
Contributor

@niklasb niklasb commented Mar 9, 2017

Otherwise it cannot be used in sd_vector constructor, probably amongst others.

@tb-robot
Copy link
Collaborator

tb-robot commented Mar 9, 2017

Can one of the admins verify this patch?

@niklasb
Copy link
Contributor Author

niklasb commented Mar 9, 2017

Somehow this iterator implementation is broken and we don't know why. We spent 2 hours now debugging it to no avail. The operator- induces undefined behaviour, looks like it accesses uninitialized stack memory. Any thoughts @simongog?

return it += i;
}

iterator& operator-(difference_type i) const
Copy link
Owner

Choose a reason for hiding this comment

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

Isn't it enough to just remove the reference here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's enough to fix the bug, yes. This pull request is primarily about about adding an assignment operator though.

Copy link
Contributor Author

@niklasb niklasb left a comment

Choose a reason for hiding this comment

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

Any progress on this?

return it += i;
}

iterator& operator-(difference_type i) const
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's enough to fix the bug, yes. This pull request is primarily about about adding an assignment operator though.

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.

3 participants