[#absl-linear_search]
= xref:absl.adoc[absl]::linear&lowbar;search
:relfileprefix: ../
:mrdocs:

Performs a linear search for a value in a range&period;

== Synopsis

Declared in `&lt;absl&sol;algorithm&sol;algorithm&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename InputIterator,
    typename EqualityComparable&gt;
constexpr
bool
linear&lowbar;search(
    InputIterator first,
    InputIterator last,
    EqualityComparable const& value);
----

== Description

Searches the range `&lsqb;first, last)&rsqb;` and returns `true` if it contains an element equal to `value`&period;

A linear search is of O(n) complexity and makes at most n &equals; (`last` &hyphen; `first`) comparisons&period; A linear search over short containers may be faster than a binary search, even when the container is sorted&period;

== Return Value

`true` if `&lsqb;first, last)&rsqb;` contains an element equal to `value`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *first*
| Iterator to the first element of the range to search&period;
| *last*
| Iterator one past the last element of the range to search&period;
| *value*
| The value to search for&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
