Namespaces
Variants

std::regex_token_iterator<BidirIt,CharT,Traits>:: regex_token_iterator

From cppreference.net
Regular expressions library
Classes
(C++11)
Algorithms
Iterators
Exceptions
Traits
Constants
(C++11)
Regex Grammar
regex_token_iterator ( ) ;
(1) (C++11부터)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type & re,
int submatch = 0 ,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) ;
(2) (C++11 이후)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type & re,
const std:: vector < int > & submatches,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) ;
(3) (C++11 이후)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type & re,
std:: initializer_list < int > submatches,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) ;
(4) (C++11 이후)
template < std:: size_t N >

regex_token_iterator ( BidirIt a, BidirIt b,
const regex_type & re,
const int ( & submatches ) [ N ] ,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) ;
(5) (C++11 이후)
regex_token_iterator ( const regex_token_iterator & other ) ;
(6) (C++11 이후)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type && re,
int submatch = 0 ,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) = delete ;
(7) (C++11 이후)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type && re,
const std:: vector < int > & submatches,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) = delete ;
(8) (C++11 이후)
regex_token_iterator ( BidirIt a, BidirIt b,

const regex_type && re,
std:: initializer_list < int > submatches,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) = delete ;
(9) (C++11 이후)
template < std:: size_t N >

regex_token_iterator ( BidirIt a, BidirIt b,
const regex_type && re,
const int ( & submatches ) [ N ] ,
std:: regex_constants :: match_flag_type m =

std:: regex_constants :: match_default ) = delete ;
(10) (C++11 이후)

새로운 regex_token_iterator 를 생성합니다:

1) 기본 생성자. 시퀀스의 끝을 가리키는 반복자를 생성합니다.
2-5) 먼저, 요청된 부분 일치 목록을 submatches 또는 submatch 인수에서 반복자에 저장된 멤버 목록으로 복사하고, a , b , re , m 를 4인자 생성자에 전달하여 멤버 std::regex_iterator 를 구성합니다(해당 생성자는 std::regex_search 에 대한 초기 호출을 수행함). 그리고 submatches 의 내부 카운터를 0으로 설정합니다.
  • 구성 후에 멤버 regex_iterator 가 시퀀스 끝 반복자가 아닌 경우, 현재 std::sub_match 의 주소로 멤버 포인터를 설정합니다.
  • 그렇지 않은 경우(멤버 regex_iterator 가 시퀀스 끝 반복자인 경우)에, - 1 값이 submatches / submatch 값 중 하나이면, * this 접미사 반복자 로 전환하여 [ a , b ) 범위를 가리키도록 합니다(전체 문자열이 일치하지 않은 접미사임).
  • 그렇지 않은 경우( - 1 submatches 목록에 없는 경우), * this 를 시퀀스 끝 반복자로 전환합니다.

submatches 내의 어떤 값이 - 1 보다 작을 경우 동작은 정의되지 않습니다.

6) 복사 생성자: 멤버별 복사를 수행합니다(멤버 regex_iterator 와 현재 sub_match 를 가리키는 멤버 포인터의 복사본을 만드는 것을 포함).
7-10) (2-5) 오버로드들은 임시 regex로 호출되는 것이 금지됩니다. 그렇지 않으면 반환된 반복자가 즉시 무효화되기 때문입니다.

매개변수

a - LegacyBidirectionalIterator 대상 문자 시퀀스의 시작을 가리키는 반복자
b - LegacyBidirectionalIterator 대상 문자 시퀀스의 끝을 가리키는 반복자
re - 대상 문자 시퀀스에서 검색에 사용되는 정규 표현식
submatch - 반환되어야 할 부분 매치의 인덱스. "0"은 전체 매치를 나타내고, "-1"은 매치되지 않은 부분을 나타냄 (예: 매치 사이의 내용)
submatches - 각 매치 내에서 반복되어야 할 부분 매치 인덱스들의 시퀀스, 비매치 조각에 대한 특수 값 - 1 을 포함할 수 있음
m - re 의 동작을 제어하는 플래그들

예제

결함 보고서

다음 동작 변경 결함 보고서는 이전에 발표된 C++ 표준에 소급 적용되었습니다.

DR 적용 대상 게시된 동작 올바른 동작
LWG 2332 C++11 임시 basic_regex 로부터 생성된 regex_token_iterator
즉시 무효화됨
삭제된 오버로드를 통해 해당 생성이 허용되지 않음