Skip to content

add assignment operator to int_vector_buffer iterator - #364

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

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

Conversation

@niklasb

@niklasb niklasb commented Mar 9, 2017

Copy link
Copy Markdown
Contributor

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

@tb-robot

tb-robot commented Mar 9, 2017

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@niklasb

niklasb commented Mar 9, 2017

Copy link
Copy Markdown
Contributor Author

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

@niklasb niklasb left a comment

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.

Any progress on this?

return it += i;
}

iterator& operator-(difference_type i) const

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.

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