GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::experimental::search(3) C++ Standard Libary std::experimental::search(3)

std::experimental::search - std::experimental::search


Defined in header <experimental/algorithm>
template<class ForwardIterator, class Searcher>


ForwardIterator search( ForwardIterator first, (library fundamentals TS)
ForwardIterator last,


const Searcher& searcher );


Searches the sequence [first, last) for the pattern specified in the constructor of
searcher.


Effectively executes searcher(first, last). (until C++17)
Effectively executes searcher(first, last).first. (since C++17)


Searcher need not be CopyConstructible.


The standard library provides the following searchers:


default_searcher standard C++ library search algorithm implementation
(class template)
boyer_moore_searcher Boyer-Moore search algorithm implementation
(class template)
boyer_moore_horspool_searcher Boyer-Moore-Horspool search algorithm implementation
(class template)


This section is incomplete


Returns the result of searcher.operator(), that is, an iterator to the location at
which the substring is found or a copy of last if it was not found.


Depends on the searcher

// Run this code


#include <iostream>
#include <string>
#include <experimental/algorithm>
#include <experimental/functional>


int main()
{
std::string in = "Lorem ipsum dolor sit amet, consectetur adipiscing elit,"
" sed do eiusmod tempor incididunt ut labore et dolore magna aliqua";
std::string needle = "pisci";
auto it = std::experimental::search(in.begin(), in.end(),
std::experimental::make_boyer_moore_searcher(
needle.begin(), needle.end()));
if(it != in.end())
std::cout << "The string " << needle << " found at offset "
<< it - in.begin() << '\n';
else
std::cout << "The string " << needle << " not found\n";
}


The string pisci found at offset 43


search searches for a range of elements
(function template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.