diff options
Diffstat (limited to 'Swiften/Base')
-rw-r--r-- | Swiften/Base/Algorithm.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Swiften/Base/Algorithm.h b/Swiften/Base/Algorithm.h index c481aa8..108dbe3 100644 --- a/Swiften/Base/Algorithm.h +++ b/Swiften/Base/Algorithm.h @@ -152,4 +152,12 @@ namespace Swift { private: V value; }; + + template <typename Map> + bool key_compare(Map const& lhs, Map const& rhs) { + + auto pred = [](decltype(*lhs.begin()) a, decltype(a) b) { return a.first == b.first; }; + + return lhs.size() == rhs.size() && std::equal(lhs.begin(), lhs.end(), rhs.begin(), pred); + } } |