From f4f9376c966489ce0ba288235c54360883590138 Mon Sep 17 00:00:00 2001 From: Tim Quatmann Date: Wed, 8 Apr 2020 11:30:19 +0200 Subject: [PATCH] Vector: Added a method for element-wise comparison of two vectors. --- src/storm/utility/vector.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/storm/utility/vector.h b/src/storm/utility/vector.h index dd562a8e1..af6098038 100644 --- a/src/storm/utility/vector.h +++ b/src/storm/utility/vector.h @@ -142,6 +142,12 @@ namespace storm { return true; } + template + bool compareElementWise(std::vector const& left, std::vector const& right, Comparator comp = std::less()) { + STORM_LOG_ASSERT(left.size() == right.size(), "Expected that vectors for comparison have equal size"); + return std::equal(left.begin(), left.end(), right.begin(), comp); + } + /*! * Selects the elements from a vector at the specified positions and writes them consecutively into another vector. * @param vector The vector into which the selected elements are to be written.