Skip to content

Commit

Permalink
removed resize in operator[] const of FixedSizedTypeVector
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Mar 8, 2024
1 parent cc2f444 commit bcd47fb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/flatmemory/details/containers/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ class FixedSizedTypeVector
}

[[nodiscard]] ConstView<T> operator[](size_t pos) const {
if (pos >= size()) {
resize(pos);
if (pos < size()) {
return m_data[pos];
}
return m_data[pos];
throw std::runtime_error("invalid argument");
}

[[nodiscard]] View<T> back() {
Expand Down

0 comments on commit bcd47fb

Please sign in to comment.