Namespaces
Variants

std:: match_results

From cppreference.net
Regular expressions library
Classes
(C++11)
match_results
(C++11)
Algorithms
Iterators
Exceptions
Traits
Constants
(C++11)
Regex Grammar
헤더 파일에 정의됨 <regex>
template <

class BidirIt,
class Alloc = std:: allocator < std:: sub_match < BidirIt >>

> class match_results ;
(1) (C++11부터)
namespace pmr {

template < class BidirIt >
using match_results = std :: match_results < BidirIt,
std:: pmr :: polymorphic_allocator <
std:: sub_match < BidirIt >>> ;

}
(2) (C++17부터)

클래스 템플릿 std::match_results 는 정규 표현식 매치의 결과를 나타내는 문자 시퀀스들의 모음을 보유합니다.

이것은 특화된 allocator-aware 컨테이너입니다. 기본 생성으로만 생성되거나, std::regex_iterator 로부터 얻어지거나, std::regex_search 또는 std::regex_match 에 의해 수정될 수 있습니다. std::match_results std::sub_match 들을 보유하고 있으며, 각각은 매치된 원본 문자 시퀀스에 대한 반복자 쌍이기 때문에, 원본 문자 시퀀스가 파괴되었거나 해당 반복자들이 다른 이유로 무효화된 경우 std::match_results 를 검사하는 것은 정의되지 않은 동작입니다.

첫 번째 std::sub_match (인덱스 0)은 std::match_result 에 포함된 항목으로 항상 정규식에 의해 대상 시퀀스 내에서 이루어진 전체 매치를 나타내며, 이후의 std::sub_match 들은 정규식 내 왼쪽 괄호로 구분된 하위 표현식에 순차적으로 대응하는 하위 표현식 매치들을 나타냅니다.

std::match_results AllocatorAwareContainer SequenceContainer 의 요구 사항을 충족합니다. 단, 복사 할당, 이동 할당 및 상수 컨테이너에 대해 정의된 연산만 지원되며, 비교 함수의 의미론이 컨테이너에 요구되는 것과 다릅니다.

목차

타입 요구사항

-
BidirIt LegacyBidirectionalIterator 요구 사항을 충족해야 합니다.
-
Alloc Allocator 요구 사항을 충족해야 합니다.

특수화

일반적인 문자 시퀀스 타입에 대한 여러 특수화가 제공됩니다:

헤더 파일에 정의됨 <regex>
유형 정의
std::cmatch std :: match_results < const char * >
std::wcmatch std :: match_results < const wchar_t * >
std::smatch std :: match_results < std :: string :: const_iterator >
std::wsmatch std :: match_results < std :: wstring :: const_iterator >
std::pmr::cmatch (C++17) std :: pmr :: match_results < const char * >
std::pmr::wcmatch (C++17) std :: pmr :: match_results < const wchar_t * >
std::pmr::smatch (C++17) std :: pmr :: match_results < std :: string :: const_iterator >
std::pmr::wsmatch (C++17) std :: pmr :: match_results < std :: wstring :: const_iterator >

멤버 타입

멤버 타입 정의
allocator_type Allocator
value_type std:: sub_match < BidirIt >
const_reference const value_type &
reference value_type&
const_iterator 구현 정의 (기반 컨테이너에 따라 다름)
iterator const_iterator
difference_type std:: iterator_traits < BidirIt > :: difference_type
size_type std:: allocator_traits < Alloc > :: size_type
char_type std:: iterator_traits < BidirIt > :: value_type
string_type std:: basic_string < char_type >

멤버 함수

객체를 생성합니다
(public member function)
객체를 소멸합니다
(public member function)
내용을 할당합니다
(public member function)
연결된 할당자를 반환합니다
(public member function)
State
결과가 사용 가능한지 확인합니다
(public member function)
Size
매치가 성공했는지 확인합니다
(public member function)
완전히 확립된 결과 상태에서 매치 개수를 반환합니다
(public member function)
가능한 최대 부분 매치 개수를 반환합니다
(public member function)
Element access
특정 부분 매치의 길이를 반환합니다
(public member function)
특정 부분 매치의 첫 번째 문자 위치를 반환합니다
(public member function)
특정 부분 매치의 문자 시퀀스를 반환합니다
(public member function)
지정된 부분 매치를 반환합니다
(public member function)
대상 시퀀스의 시작과 전체 매치의 시작 사이의 부분 시퀀스를 반환합니다
(public member function)
전체 매치의 끝과 대상 시퀀스의 끝 사이의 부분 시퀀스를 반환합니다
(public member function)
Iterators
부분 매치 목록의 시작에 대한 반복자를 반환합니다
(public member function)
부분 매치 목록의 끝에 대한 반복자를 반환합니다
(public member function)
Format
출력을 위해 매치 결과를 포맷합니다
(public member function)
Modifiers
내용을 교환합니다
(public member function)

비멤버 함수

(C++20에서 제거됨)
두 match_result의 값을 사전식으로 비교
(함수 템플릿)
std::swap 알고리즘을 특수화
(함수 템플릿)