summaryrefslogtreecommitdiff
path: root/absl/algorithm/algorithm.h
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2019-11-15 08:07:12 -0800
committerGravatar Andy Getz <durandal@google.com>2019-11-15 11:16:16 -0500
commit3df7b52a6ada51a72a23796b844549a7b282f1b8 (patch)
tree12f9fb49f9c955408628aafaf9448ecaf357ee8d /absl/algorithm/algorithm.h
parentfa8c75182fbfdeddb2485fc0d53baeda3f40b7a3 (diff)
Export of internal Abseil changes
-- 3a871e2cd854a46770a9416189953b2b38980bcf by Andy Getzendanner <durandal@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 280660534 -- f5a155fb056dcf68b089c21aebb5bf5159dc0eb3 by Tom Manshreck <shreck@google.com>: Nit: fix format of algorithm.h comments PiperOrigin-RevId: 280474139 -- 08b117a18353c0daf51b33b45100e5a007e5ab0c by Abseil Team <absl-team@google.com>: Allow absl::Notification::HasBeenNotified to be inlined. PiperOrigin-RevId: 280453271 -- 26d33dd2bad72945f1987f7b2669dbec3a6247e6 by Derek Mauro <dmauro@google.com>: Fix unused variable warnings on Windows PiperOrigin-RevId: 280324417 -- 907e9b23029be683af3b443bafd6a577a595922f by Abseil Team <absl-team@google.com>: PeriodicSampler implementation (for internal-use only) PiperOrigin-RevId: 280257168 GitOrigin-RevId: 3a871e2cd854a46770a9416189953b2b38980bcf Change-Id: I6e2978cae22a6adc41c0577e5c21355e9db7c8f5
Diffstat (limited to 'absl/algorithm/algorithm.h')
-rw-r--r--absl/algorithm/algorithm.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/absl/algorithm/algorithm.h b/absl/algorithm/algorithm.h
index bb90215d..771228a0 100644
--- a/absl/algorithm/algorithm.h
+++ b/absl/algorithm/algorithm.h
@@ -84,6 +84,8 @@ It RotateImpl(It first, It middle, It last, std::false_type) {
} // namespace algorithm_internal
+// equal()
+//
// Compares the equality of two ranges specified by pairs of iterators, using
// the given predicate, returning true iff for each corresponding iterator i1
// and i2 in the first and second range respectively, pred(*i1, *i2) == true
@@ -104,8 +106,8 @@ bool equal(InputIter1 first1, InputIter1 last1, InputIter2 first2,
typename std::iterator_traits<InputIter2>::iterator_category{});
}
-// Performs comparison of two ranges specified by pairs of iterators using
-// operator==.
+// Overload of equal() that performs comparison of two ranges specified by pairs
+// of iterators using operator==.
template <typename InputIter1, typename InputIter2>
bool equal(InputIter1 first1, InputIter1 last1, InputIter2 first2,
InputIter2 last2) {
@@ -113,6 +115,8 @@ bool equal(InputIter1 first1, InputIter1 last1, InputIter2 first2,
algorithm_internal::EqualTo{});
}
+// linear_search()
+//
// Performs a linear search for `value` using the iterator `first` up to
// but not including `last`, returning true if [`first`, `last`) contains an
// element equal to `value`.
@@ -126,6 +130,8 @@ bool linear_search(InputIterator first, InputIterator last,
return std::find(first, last, value) != last;
}
+// rotate()
+//
// Performs a left rotation on a range of elements (`first`, `last`) such that
// `middle` is now the first element. `rotate()` returns an iterator pointing to
// the first element before rotation. This function is exactly the same as
@@ -135,7 +141,6 @@ bool linear_search(InputIterator first, InputIterator last,
// The complexity of this algorithm is the same as that of `std::rotate`, but if
// `ForwardIterator` is not a random-access iterator, then `absl::rotate`
// performs an additional pass over the range to construct the return value.
-
template <typename ForwardIterator>
ForwardIterator rotate(ForwardIterator first, ForwardIterator middle,
ForwardIterator last) {