std::match_results<BidirIt,Alloc>:: ready
From cppreference.net
<
cpp
|
regex
|
match results
C++
Text processing library
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Regular expressions library
| Classes | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Algorithms | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Iterators | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Exceptions | ||||
|
(C++11)
|
||||
| Traits | ||||
|
(C++11)
|
||||
| Constants | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Regex Grammar | ||||
|
(C++11)
|
std::match_results
| Member functions | ||||
| State | ||||
|
match_results::ready
|
||||
| Element access | ||||
| Iterators | ||||
| Format | ||||
| Modifiers | ||||
| Non-member functions | ||||
|
(until C++20)
|
||||
|
bool
ready
(
)
const
;
|
(C++11 이후) | |
매치 결과가 준비되었는지(유효한지) 여부를 나타냅니다.
기본 생성된 매치 결과는 결과 상태가 없으며(준비 상태가 아님), 정규식 알고리즘 중 하나에 의해서만 준비 상태로 만들 수 있습니다. ready 상태는 모든 매치 결과가 완전히 확립되었음을 의미합니다.
match_results
객체가
준비되지 않은
상태에서 대부분의 멤버 함수를 호출한 결과는 정의되지 않습니다.
반환값
true 매치 결과가 준비된 경우, false 그렇지 않은 경우.
예제
이 코드 실행
#include <iostream> #include <regex> #include <string> int main() { std::string target("big-red-cat"); std::smatch sm; std::cout << "Default constructed smatch is " << (sm.ready() ? "ready.\n" : "not ready.\n"); std::regex re1(".*-red-.*"); std::regex_search(target, sm, re1); std::cout << "After search, smatch is " << (sm.ready() ? "ready.\n" : "not ready.\n"); }
출력:
Default constructed smatch is not ready. After search, smatch is ready.