Skip to content

Conversation

@SGSSGene
Copy link
Collaborator

@SGSSGene SGSSGene commented Apr 2, 2025

Fixes a categorization bug of an iterator.
int_vector_buffer::iterator announces its iterator_category as std::random_access_iterator_tag. This requires
to support expression like <, >, <=, >=.
This Bug is only triggered if additionally the _GLIBCXX_DEBUG flag is set.

I have a "minimal example" prepared, adjust line '82' to see my fix and/or see the compiler flags to remove the trigger : https://godbolt.org/z/W65szx7Pz

(also I fixed another minor const correctness bug in a second commit)

@SGSSGene SGSSGene requested a review from eseiler April 2, 2025 21:02

bool operator<(iterator const & it) const
{
return m_idx < it.m_idx;
Copy link
Collaborator

@eseiler eseiler Apr 3, 2025

Choose a reason for hiding this comment

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

I think the PR is fine as is, but I'm unsure about iterator comparisons.

What about m_ivb?

It only makes sense to ask for relations if both iterators point to the same container, no?
I think, technically, comparing two iterators referring to different containers/ranges is UB anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

mhm, I could add assert statements that check that m_ivb is non-zero and equal?

@SGSSGene SGSSGene requested a review from eseiler April 3, 2025 13:35
@eseiler eseiler enabled auto-merge April 3, 2025 13:41
@eseiler eseiler merged commit a2e2bab into xxsds:master Apr 3, 2025
34 checks passed
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.

2 participants