From 3df7b52a6ada51a72a23796b844549a7b282f1b8 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Fri, 15 Nov 2019 08:07:12 -0800 Subject: Export of internal Abseil changes -- 3a871e2cd854a46770a9416189953b2b38980bcf by Andy Getzendanner : Import of CCTZ from GitHub. PiperOrigin-RevId: 280660534 -- f5a155fb056dcf68b089c21aebb5bf5159dc0eb3 by Tom Manshreck : Nit: fix format of algorithm.h comments PiperOrigin-RevId: 280474139 -- 08b117a18353c0daf51b33b45100e5a007e5ab0c by Abseil Team : Allow absl::Notification::HasBeenNotified to be inlined. PiperOrigin-RevId: 280453271 -- 26d33dd2bad72945f1987f7b2669dbec3a6247e6 by Derek Mauro : Fix unused variable warnings on Windows PiperOrigin-RevId: 280324417 -- 907e9b23029be683af3b443bafd6a577a595922f by Abseil Team : PeriodicSampler implementation (for internal-use only) PiperOrigin-RevId: 280257168 GitOrigin-RevId: 3a871e2cd854a46770a9416189953b2b38980bcf Change-Id: I6e2978cae22a6adc41c0577e5c21355e9db7c8f5 --- absl/algorithm/algorithm.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'absl/algorithm') diff --git a/absl/algorithm/algorithm.h b/absl/algorithm/algorithm.h index bb90215..771228a 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::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 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 ForwardIterator rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last) { -- cgit v1.2.3