diff --git a/BaseLib/ContainerTools.h b/BaseLib/ContainerTools.h index 5746fc827d03b4a57d8b2b414ef55caec4a0de42..0efee8fe99675ae39a625f643108f3d56f4cd7f6 100644 --- a/BaseLib/ContainerTools.h +++ b/BaseLib/ContainerTools.h @@ -49,6 +49,18 @@ struct PolymorphicRandomAccessContainerViewIterator return copy; } + PolymorphicRandomAccessContainerViewIterator& operator--() noexcept + { + --n_; + return *this; + } + PolymorphicRandomAccessContainerViewIterator operator--(int) noexcept + { + auto copy{*this}; + operator--(); + return copy; + } + [[nodiscard]] Element& operator*() const { return (*view_)[n_]; } [[nodiscard]] bool operator==( diff --git a/Tests/BaseLib/TestContainerTools.cpp b/Tests/BaseLib/TestContainerTools.cpp index 30ff8e7fc05f2585402765a1d0c49ab252612e46..0406d4c2bfa93e9a64820ffe7117fd5b8af68335 100644 --- a/Tests/BaseLib/TestContainerTools.cpp +++ b/Tests/BaseLib/TestContainerTools.cpp @@ -83,6 +83,7 @@ TEST(BaseLib, ContainerToolsIteratorAndRangeConcepts) using IteratorType = decltype(view.begin()); static_assert(std::input_iterator<IteratorType>); static_assert(std::forward_iterator<IteratorType>); + static_assert(std::bidirectional_iterator<IteratorType>); } TEST(BaseLib, ContainerToolsNoUpCast)