From 0c03c28a3b7609d218a9acdff099fc0bda0f4ae6 Mon Sep 17 00:00:00 2001 From: Gil Date: Fri, 20 Apr 2018 12:11:19 -0700 Subject: Implement find-related methods on C++ immutable maps (#1145) * Standardize method ordering across sorted maps * Add SortedMap::find * Add SortedMap::find_index * Add SortedMap::contains --- Firestore/core/src/firebase/firestore/util/comparison.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Firestore/core/src/firebase/firestore/util') diff --git a/Firestore/core/src/firebase/firestore/util/comparison.h b/Firestore/core/src/firebase/firestore/util/comparison.h index 23207f5..d7f4dfd 100644 --- a/Firestore/core/src/firebase/firestore/util/comparison.h +++ b/Firestore/core/src/firebase/firestore/util/comparison.h @@ -114,9 +114,10 @@ struct Comparator> * Perform a three-way comparison between the left and right values using * the appropriate Comparator for the values based on their type. */ -template -ComparisonResult Compare(const T& left, const T& right) { - Comparator less_than; +template > +ComparisonResult Compare(const T& left, + const T& right, + const C& less_than = C()) { if (less_than(left, right)) { return ComparisonResult::Ascending; } else if (less_than(right, left)) { -- cgit v1.2.3