regex_match_results
regex_match_results (정규식 일치 결과)
std::match_results은 정규식 일치의 결과를 나타내는 문자 시퀀스의 모음(컬렉션)을 담는 클래스 템플릿이에요. C++11부터 사용할 수 있어요.
출처: cppreference
본문
<regex> 헤더에 정의되어 있고, 시그니처는 다음과 같아요.
template<
class BidirIt,
class Alloc = std::allocator<std::sub_match<BidirIt>>
> class match_results;
(1) (since C++11)
namespace pmr {
template <class BidirIt>
using match_results = std::match_results<BidirIt,
std::pmr::polymorphic_allocator<
std::sub_match<BidirIt>>>;
}
(2) (since C++17)
클래스 템플릿 std::match_results은 정규식 일치의 결과를 나타내는 문자 시퀀스의 모음(컬렉션)을 담아요.
이것은 특수화된 할당자 인식 컨테이너예요. 기본 생성되거나, std::regex_iterator에서 얻거나, std::regex_search 또는 std::regex_match로만 수정할 수 있어요. std::match_results은 각각 원래 일치된 문자 시퀀스에 대한 반복자 쌍인 std::sub_match를 담기 때문에, 원래 문자 시퀀스가 파괴되거나 그 반복자가 무효화되면 std::match_results을 검사하는 것은 정의되지 않은 동작이에요.
멤버 타입 (Member types)
| 멤버 타입 | 정의 |
|---|---|
| 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 |
| allocator_type | Alloc |
| char_type | std::iterator_traits<BidirIt>::value_type |
| string_type | std::basic_string<char_type> |
멤버 함수 (Member functions)
- (constructor), swap, size, max_size, empty, operator[], prefix, suffix, length, position, str, begin, end, ready, format, get_allocator 등이 제공돼요.