diff options
author | Gil <mcg@google.com> | 2018-04-20 12:11:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-20 12:11:19 -0700 |
commit | 0c03c28a3b7609d218a9acdff099fc0bda0f4ae6 (patch) | |
tree | 944ffbf8158b1faf75d8baa09abaec427b699222 /Firestore/core/src/firebase/firestore/util | |
parent | ede57f84bb4ddcc438bba34ef4407ee86fbaf2f9 (diff) |
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
Diffstat (limited to 'Firestore/core/src/firebase/firestore/util')
-rw-r--r-- | Firestore/core/src/firebase/firestore/util/comparison.h | 7 |
1 files changed, 4 insertions, 3 deletions
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<std::vector<uint8_t>> * Perform a three-way comparison between the left and right values using * the appropriate Comparator for the values based on their type. */ -template <typename T> -ComparisonResult Compare(const T& left, const T& right) { - Comparator<T> less_than; +template <typename T, typename C = Comparator<T>> +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)) { |