Skip to content

Commit

Permalink
utils/fragmented_vector: Add test for iterator::operator->
Browse files Browse the repository at this point in the history
Operator added in redpanda-data#11691

Signed-off-by: Ben Pope <ben@redpanda.com>
  • Loading branch information
BenPope committed Oct 2, 2023
1 parent 239a9f0 commit a2b9966
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/v/utils/fragmented_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class fragmented_vector {
iter() = default;

reference operator*() const { return _vec->operator[](_index); }
pointer operator->() const { return &_vec->operator[](_index); }

iter& operator+=(ssize_t n) {
_index += n;
Expand Down Expand Up @@ -280,8 +281,6 @@ class fragmented_vector {
return tmp;
}

pointer operator->() const { return &_vec->operator[](_index); }

iter operator+(difference_type offset) { return iter{*this} += offset; }
iter operator-(difference_type offset) { return iter{*this} -= offset; }

Expand Down
1 change: 1 addition & 0 deletions src/v/utils/tests/fragmented_vector_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ BOOST_AUTO_TEST_CASE(fragmented_vector_iterator_access) {

BOOST_CHECK_EQUAL(*vec.begin(), foo{2});
BOOST_CHECK_EQUAL((*vec.begin()).a, 2);
BOOST_CHECK_EQUAL(vec.begin()->a, 2);
}

/**
Expand Down

0 comments on commit a2b9966

Please sign in to comment.