[#BloombergLP-bslstl-BoyerMooreHorspoolSearcher]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::BoyerMooreHorspoolSearcher
:relfileprefix: ../../
:mrdocs:

This class template implements an STL&hyphen;compliant searcher object that uses the Boyer, Moore, Horspool Algorithm&period; Several non&hyphen;standard accessors are also provided&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;boyermoorehorspoolsearcher&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class RNDACC&lowbar;ITR&lowbar;NEEDLE,
    class HASH = xref:bsl/hash-06.adoc[bsl::hash&lt;bsl::iterator&lowbar;traits&lt;RNDACC&lowbar;ITR&lowbar;NEEDLE&gt;::value&lowbar;type&gt;],
    class EQUAL = xref:bsl/equal_to-0d.adoc[bsl::equal&lowbar;to&lt;bsl::iterator&lowbar;traits&lt;RNDACC&lowbar;ITR&lowbar;NEEDLE&gt;::value&lowbar;type&gt;]&gt;
class BoyerMooreHorspoolSearcher;
----

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/BoyerMooreHorspoolSearcher/DefaultEqual.adoc[`DefaultEqual`] 
| the default type for the `EQUAL` optional template parameter
| xref:BloombergLP/bslstl/BoyerMooreHorspoolSearcher/DefaultHash.adoc[`DefaultHash`] 
| the default type for the `HASH` optional template parameter
| xref:BloombergLP/bslstl/BoyerMooreHorspoolSearcher/value_type.adoc[`value&lowbar;type`] 
| the type of the values that can be obtained by dereferencing a `RNDACC&lowbar;ITR&lowbar;NEEDLE`
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/BoyerMooreHorspoolSearcher/2constructor-0c6.adoc[`BoyerMooreHorspoolSearcher`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bslstl/BoyerMooreHorspoolSearcher/operator_assign-0c2.adoc[`operator&equals;`] 
| Assignment operators
| xref:BloombergLP/bslstl/BoyerMooreHorspoolSearcher/allocator.adoc[`allocator`] 
| Return the allocator used by this object to supply memory&period;
| xref:BloombergLP/bslstl/BoyerMooreHorspoolSearcher/equal.adoc[`equal`] 
| Return the equality comparison functor supplied on construction&period;
| xref:BloombergLP/bslstl/BoyerMooreHorspoolSearcher/hash.adoc[`hash`] 
| Return the hashing functor supplied on construction&period;
| xref:BloombergLP/bslstl/BoyerMooreHorspoolSearcher/needleFirst.adoc[`needleFirst`] 
| Return an iterator referring to the first element of the sequence of `value&lowbar;type` values that can be sought by this searcher object&period;
| xref:BloombergLP/bslstl/BoyerMooreHorspoolSearcher/needleLast.adoc[`needleLast`] 
| Return an iterator referring to one past the last element of the sequence of `value&lowbar;type` values that can be sought by this searcher object&period;
| xref:BloombergLP/bslstl/BoyerMooreHorspoolSearcher/operator_call.adoc[`operator()`] 
| Search the specified range `&lsqb;haystackFirst, haystackLast)&rsqb;` for the first sequence of `value&lowbar;type` values specified on construction&period; Return the range where those values are found, or the range `&lsqb;haystackLast, haystackLast)&rsqb;` if that sequence is not found&period; The search is performed using an implementation of the Boyer Moore Horspool algorithm and has a complexity of O(N) for random text&period; Values of the &quot;needle&quot; sequence and the &quot;haystack&quot; sequence are compared using the equality comparison functor specified on construction&period; The behavior is undefined unless `haystackFirst` can be advanced to `haystackLast` and the iterators used to construct this object, `needleFirst()` and `needleLast()`, are still valid&period; Note that if the &quot;needle&quot; sequence is empty, the range `&lsqb;haystackFirst, haystackFirst)&rsqb;` is returned&period; Also note that if the &quot;needle&quot; sequence is longer than the &quot;haystack&quot; sequence &hyphen;&hyphen; thus, impossible for the &quot;needle&quot; to be found in the &quot;haystack&quot; &hyphen;&hyphen; the range `&lsqb;haystackLast, haystackLast)&rsqb;` is returned&period;
|===



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