[Scummvm-git-logs] scummvm master -> 9380f2f7da621aa4e13fc718bc6fefe13c68fc86
grisenti
noreply at scummvm.org
Thu Jun 1 17:11:31 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9380f2f7da COMMON: Improve documentation for lower/upperBound
Commit: 9380f2f7da621aa4e13fc718bc6fefe13c68fc86
https://github.com/scummvm/scummvm/commit/9380f2f7da621aa4e13fc718bc6fefe13c68fc86
Author: grisenti (emanuele at grisenti.net)
Date: 2023-06-01T19:10:59+02:00
Commit Message:
COMMON: Improve documentation for lower/upperBound
Changed paths:
common/algorithm.h
diff --git a/common/algorithm.h b/common/algorithm.h
index 943d4e6fc76..558556e0c40 100644
--- a/common/algorithm.h
+++ b/common/algorithm.h
@@ -417,6 +417,11 @@ It remove(It first, It last, const T& val) {
/**
* Finds the first item in the range [first, last) for which comp(item, val)
* (item < val by default) is false.
+ * Items in the range [first, last) need to be partitioned by comp(item, val), that is,
+ * all items for which comp(item, val) is true (items that are less than val)
+ * come before all items for which the expression is false (items that are bigger than or
+ * equal to val). A sorted range conforms to the requirement.
+ *
* This function is the equivalent of std::lower_bound for random access iterators.
*/
template<typename RandomIt, typename V, typename Comp = Less<V> >
@@ -434,6 +439,11 @@ RandomIt lowerBound(RandomIt first, RandomIt last, const V &val, Comp comp = {})
/**
* Finds the first item in the range [first, last) for which comp(val, item)
* (val < item by default) is true.
+ * Items in the range [first, last) need to be partitioned by !comp(val, item), that is,
+ * all items for which !comp(val, item) is true (items that are less than or equal to val),
+ * come before all items for which the expression is false (items that are greater than val).
+ * A sorted range conforms to the requirement.
+ *
* This function is the equivalent of std::upper_bound for random access iterators.
*/
template<typename RandomIt, typename V, typename Comp = Less<V> >
More information about the Scummvm-git-logs
mailing list