[#absl-linear_search] = xref:absl.adoc[absl]::linear_search :relfileprefix: ../ :mrdocs: Performs a linear search for a value in a range. == Synopsis Declared in `<absl/algorithm/algorithm.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename InputIterator, typename EqualityComparable> constexpr bool linear_search( InputIterator first, InputIterator last, EqualityComparable const& value); ---- == Description Searches the range `[first, last)]` and returns `true` if it contains an element equal to `value`. A linear search is of O(n) complexity and makes at most n = (`last` ‐ `first`) comparisons. A linear search over short containers may be faster than a binary search, even when the container is sorted. == Return Value `true` if `[first, last)]` contains an element equal to `value`. == Parameters [cols="1,4"] |=== | Name| Description | *first* | Iterator to the first element of the range to search. | *last* | Iterator one past the last element of the range to search. | *value* | The value to search for. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#