Lines Matching +full:container +full:- +full:based
7 // https://www.apache.org/licenses/LICENSE-2.0
15 // -----------------------------------------------------------------------------
16 // File: container.h
17 // -----------------------------------------------------------------------------
19 // This header file provides Container-based versions of algorithmic functions
31 // `absl::c_xx(container, ...) are equivalent to std:: functions such as
36 // For template parameter and variable naming, `C` indicates the container type
124 //------------------------------------------------------------------------------
126 //------------------------------------------------------------------------------
130 // Container-based version of absl::linear_search() for performing a linear
131 // search within a container.
139 //------------------------------------------------------------------------------
141 //------------------------------------------------------------------------------
145 // Container-based version of the <iterator> `std::distance()` function to
146 // return the number of elements within a container.
154 //------------------------------------------------------------------------------
155 // <algorithm> Non-modifying sequence operations
156 //------------------------------------------------------------------------------
160 // Container-based version of the <algorithm> `std::all_of()` function to
161 // test if all elements within a container satisfy a condition.
171 // Container-based version of the <algorithm> `std::any_of()` function to
172 // test if any element in a container fulfills a condition.
182 // Container-based version of the <algorithm> `std::none_of()` function to
183 // test if no elements in a container fulfill a condition.
193 // Container-based version of the <algorithm> `std::for_each()` function to
194 // apply a function to a container's elements.
204 // Container-based version of the <algorithm> `std::find()` function to find
205 // the first element containing the passed value within a container value.
215 // Container-based version of the <algorithm> `std::find_if()` function to find
216 // the first element in a container matching the given condition.
226 // Container-based version of the <algorithm> `std::find_if_not()` function to
227 // find the first element in a container not matching the given condition.
238 // Container-based version of the <algorithm> `std::find_end()` function to
239 // find the last subsequence within a container.
263 // Container-based version of the <algorithm> `std::find_first_of()` function to
264 // find the first element within the container that is also within the options
265 // container.
267 container_algorithm_internal::ContainerIter<C1> c_find_first_of(C1& container,
269 return std::find_first_of(container_algorithm_internal::c_begin(container),
270 container_algorithm_internal::c_end(container),
279 C1& container, C2& options, BinaryPredicate&& pred) {
280 return std::find_first_of(container_algorithm_internal::c_begin(container),
281 container_algorithm_internal::c_end(container),
289 // Container-based version of the <algorithm> `std::adjacent_find()` function to
290 // find equal adjacent elements within a container.
310 // Container-based version of the <algorithm> `std::count()` function to count
311 // values that match within a container.
322 // Container-based version of the <algorithm> `std::count_if()` function to
323 // count values matching a condition within a container.
334 // Container-based version of the <algorithm> `std::mismatch()` function to
360 // Container-based version of the <algorithm> `std::equal()` function to
383 // Container-based version of the <algorithm> `std::is_permutation()` function
384 // to test whether a container is a permutation of another.
406 // Container-based version of the <algorithm> `std::search()` function to search
407 // a container for a subsequence.
431 // Container-based version of the <algorithm> `std::search_n()` function to
432 // search a container for the first sequence of N elements.
453 //------------------------------------------------------------------------------
455 //------------------------------------------------------------------------------
459 // Container-based version of the <algorithm> `std::copy()` function to copy a
460 // container's elements into an iterator.
469 // Container-based version of the <algorithm> `std::copy_n()` function to copy a
470 // container's first N elements into an iterator.
478 // Container-based version of the <algorithm> `std::copy_if()` function to copy
479 // a container's elements satisfying some condition into an iterator.
490 // Container-based version of the <algorithm> `std::copy_backward()` function to
491 // copy a container's elements in reverse order into an iterator.
501 // Container-based version of the <algorithm> `std::move()` function to move
502 // a container's elements into an iterator.
511 // Container-based version of the <algorithm> `std::move_backward()` function to
512 // move a container's elements into an iterator in reverse order.
521 // Container-based version of the <algorithm> `std::swap_ranges()` function to
522 // swap a container's elements with another container's elements. Swaps the
540 // Container-based version of the <algorithm> `std::transform()` function to
541 // transform a container's elements using the unary operation, storing the
574 // Container-based version of the <algorithm> `std::replace()` function to
575 // replace a container's elements of some value with a new value. The container
586 // Container-based version of the <algorithm> `std::replace_if()` function to
587 // replace a container's elements of some value with a new value based on some
588 // condition. The container is modified in place.
598 // Container-based version of the <algorithm> `std::replace_copy()` function to
599 // replace a container's elements of some value with a new value and return the
612 // Container-based version of the <algorithm> `std::replace_copy_if()` function
613 // to replace a container's elements of some value with a new value based on
625 // Container-based version of the <algorithm> `std::fill()` function to fill a
626 // container with some value.
635 // Container-based version of the <algorithm> `std::fill_n()` function to fill
636 // the first N elements in a container with some value.
644 // Container-based version of the <algorithm> `std::generate()` function to
645 // assign a container's elements to the values provided by the given generator.
655 // Container-based version of the <algorithm> `std::generate_n()` function to
656 // assign a container's first N elements to the values provided by the given
665 // Note: `c_xx()` <algorithm> container versions for `remove()`, `remove_if()`,
672 // Container-based version of the <algorithm> `std::remove_copy()` function to
673 // copy a container's elements while removing any elements matching the given
685 // Container-based version of the <algorithm> `std::remove_copy_if()` function
686 // to copy a container's elements while removing any elements matching the given
698 // Container-based version of the <algorithm> `std::unique_copy()` function to
699 // copy a container's elements while removing any elements containing duplicate
719 // Container-based version of the <algorithm> `std::reverse()` function to
720 // reverse a container's elements.
729 // Container-based version of the <algorithm> `std::reverse()` function to
730 // reverse a container's elements and write them to an iterator range.
740 // Container-based version of the <algorithm> `std::rotate()` function to
741 // shift a container's elements leftward such that the `middle` element becomes
742 // the first element in the container.
752 // Container-based version of the <algorithm> `std::rotate_copy()` function to
753 // shift a container's elements leftward such that the `middle` element becomes
767 // Container-based version of the <algorithm> `std::shuffle()` function to
768 // randomly shuffle elements within the container using a `gen()` uniform random
779 // Container-based version of the <algorithm> `std::sample()` function to
780 // randomly sample elements from the container without replacement using a
791 // Fall back to a stable selection-sampling implementation.
797 std::uniform_int_distribution<Distance>(0, --unsampled_elements)(gen);
800 --n;
807 //------------------------------------------------------------------------------
809 //------------------------------------------------------------------------------
813 // Container-based version of the <algorithm> `std::is_partitioned()` function
814 // to test whether all elements in the container for which `pred` returns `true`
825 // Container-based version of the <algorithm> `std::partition()` function
826 // to rearrange all elements in a container in such a way that all elements for
838 // Container-based version of the <algorithm> `std::stable_partition()` function
839 // to rearrange all elements in a container in such a way that all elements for
853 // Container-based version of the <algorithm> `std::partition_copy()` function
854 // to partition a container's elements and return them into two iterators: one
869 // Container-based version of the <algorithm> `std::partition_point()` function
870 // to return the first element of an already partitioned container for which
880 //------------------------------------------------------------------------------
882 //------------------------------------------------------------------------------
886 // Container-based version of the <algorithm> `std::sort()` function
905 // Container-based version of the <algorithm> `std::stable_sort()` function
925 // Container-based version of the <algorithm> `std::is_sorted()` function
926 // to evaluate whether the given container is sorted in ascending order.
944 // Container-based version of the <algorithm> `std::partial_sort()` function
945 // to rearrange elements within a container such that elements before `middle`
969 // Container-based version of the <algorithm> `std::partial_sort_copy()`
972 // At most min(result.last - result.first, sequence.last - sequence.first)
998 // Container-based version of the <algorithm> `std::is_sorted_until()` function
999 // to return the first element within a container that is not sorted in
1019 // Container-based version of the <algorithm> `std::nth_element()` function
1020 // to rearrange the elements within a container such that the `nth` element
1044 //------------------------------------------------------------------------------
1046 //------------------------------------------------------------------------------
1050 // Container-based version of the <algorithm> `std::lower_bound()` function
1051 // to return an iterator pointing to the first element in a sorted container
1072 // Container-based version of the <algorithm> `std::upper_bound()` function
1073 // to return an iterator pointing to the first element in a sorted container
1094 // Container-based version of the <algorithm> `std::equal_range()` function
1096 // sorted container which compare equal to `value`.
1116 // Container-based version of the <algorithm> `std::binary_search()` function
1117 // to test if any element in the sorted container contains a value equivalent to
1136 //------------------------------------------------------------------------------
1138 //------------------------------------------------------------------------------
1142 // Container-based version of the <algorithm> `std::merge()` function
1166 // Container-based version of the <algorithm> `std::inplace_merge()` function
1167 // to merge a supplied iterator `middle` into a container.
1188 // Container-based version of the <algorithm> `std::includes()` function
1189 // to test whether a sorted container `c1` entirely contains another sorted
1190 // container `c2`.
1212 // Container-based version of the <algorithm> `std::set_union()` function
1249 // Container-based version of the <algorithm> `std::set_intersection()` function
1296 // Container-based version of the <algorithm> `std::set_difference()` function
1297 // to return an iterator containing elements present in the first container but
1334 // Container-based version of the <algorithm> `std::set_symmetric_difference()`
1336 // container or the other, but not both.
1373 //------------------------------------------------------------------------------
1375 //------------------------------------------------------------------------------
1379 // Container-based version of the <algorithm> `std::push_heap()` function
1380 // to push a value onto a container heap.
1398 // Container-based version of the <algorithm> `std::pop_heap()` function
1399 // to pop a value from a heap container.
1417 // Container-based version of the <algorithm> `std::make_heap()` function
1418 // to make a container a heap.
1436 // Container-based version of the <algorithm> `std::sort_heap()` function
1455 // Container-based version of the <algorithm> `std::is_heap()` function
1456 // to check whether the given container is a heap.
1474 // Container-based version of the <algorithm> `std::is_heap_until()` function
1475 // to find the first element in a given container which is not in heap order.
1493 //------------------------------------------------------------------------------
1495 //------------------------------------------------------------------------------
1499 // Container-based version of the <algorithm> `std::min_element()` function
1521 // Container-based version of the <algorithm> `std::max_element()` function
1543 // Container-based version of the <algorithm> `std::minmax_element()` function
1564 //------------------------------------------------------------------------------
1566 //------------------------------------------------------------------------------
1570 // Container-based version of the <algorithm> `std::lexicographical_compare()`
1572 // container sequences. The comparison is performed using `operator<`. Note
1573 // that capital letters ("A-Z") have ASCII values less than lowercase letters
1574 // ("a-z").
1600 // Container-based version of the <algorithm> `std::next_permutation()` function
1601 // to rearrange a container's elements into the next lexicographically greater
1620 // Container-based version of the <algorithm> `std::prev_permutation()` function
1621 // to rearrange a container's elements into the next lexicographically lesser
1638 //------------------------------------------------------------------------------
1640 //------------------------------------------------------------------------------
1644 // Container-based version of the <numeric> `std::iota()` function
1646 // after each element is written, and write them to the container.
1655 // Container-based version of the <numeric> `std::accumulate()` function
1656 // to accumulate the element values of a container to `init` and return that
1682 // Container-based version of the <numeric> `std::inner_product()` function
1683 // to compute the cumulative inner product of container element pairs.
1699 // the product between the two container's element pair).
1713 // Container-based version of the <numeric> `std::adjacent_difference()`
1736 // Container-based version of the <numeric> `std::partial_sum()` function