std::experimental:: default_searcher, std::experimental:: make_default_searcher
|
헤더 파일에 정의됨
<experimental/functional>
|
||
|
template
<
class
ForwardIterator1,
class
BinaryPredicate
=
std::
equal_to
<>
>
class default_searcher ; |
(라이브러리 펀더멘털 TS) | |
std::experimental::search 와 함께 사용하기 적합한 클래스로, 검색 작업을 표준 라이브러리의 std::search 에 위임합니다.
default_searcher
는
CopyConstructible
이고
CopyAssignable
입니다.
목차
멤버 함수std::experimental::default_searcher:: default_searcher
매개변수
예외
std::experimental::default_searcher::operator()
에 의해 호출되는 멤버 함수는 std::experimental::search을 사용하여 이 검색기로 검색을 수행합니다.
매개변수
반환 값
헬퍼 함수
템플릿 인자 추론을 사용하여
매개변수
반환값
예제
이 코드 실행
#include <experimental/algorithm> #include <experimental/functional> #include <iostream> #include <string> 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_default_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 참고 항목
|