Difference between revisions of "cpp/regex/match results"
From cppreference.com
m (Text replace - "/sidebar" to "/navbar") |
Andreas Krug (Talk | contribs) m (fmt) |
||
(24 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
{{cpp/title|match_results}} | {{cpp/title|match_results}} | ||
{{cpp/regex/match_results/navbar}} | {{cpp/regex/match_results/navbar}} | ||
− | {{ | + | {{ |
+ | header| | ||
+ | {{sincec++11|1= | ||
template< | template< | ||
− | class | + | class , |
− | class | + | class = std::allocator<std::sub_match<>> |
> class match_results; | > class match_results; | ||
}} | }} | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
− | The class template {{ | + | The class template {{|std::match_results}} holds a collection of character sequences that represent the result of a regular expression match. |
− | This is a specialized allocator-aware container. | + | This is a specialized allocator-aware container. It can only be default createdor modified by {{|std::regex_search}} or {{|std::regex_match}}. |
− | The first sub_match (index 0) contained in a match_result always represents the full match within a target sequence made by a regex, and subsequent | + | The first sub_match(index 0) contained in a match_resultalways represents the full match within a target sequence made by a regex, and subsequent represent sub-expression matches corresponding in sequence to the left parenthesis delimiting the sub-expression in the regex. |
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
Several specializations for common character sequence types are provided: | Several specializations for common character sequence types are provided: | ||
− | {{ | + | {{begin}} |
− | {{ | + | {{header|regex}} |
− | {{ | + | {{hitem|Type|Definition}} |
− | {{ | + | {{|{{tt|cmatch}}|{{c|match_results<const char*>}}}} |
− | {{ | + | {{|{{tt|wcmatch}}|{{c|match_results<const wchar_t*>}}}} |
− | {{ | + | {{|{{tt|smatch}}|{{c|match_results<std::string::const_iterator>}}}} |
− | {{ | + | {{|{{tt|wsmatch}}|{{c| |
− | {{ | + | |
+ | |||
+ | |||
+ | match_results<std::wstring::const_iterator>}}}} | ||
+ | {{end}} | ||
===Member types=== | ===Member types=== | ||
− | {{ | + | {{begin}} |
− | {{ | + | {{hitem|Member type|Definition}} |
− | {{ | + | {{|{{tt|allocator_type}}|{{|Allocator}}}} |
− | {{ | + | {{|{{tt|value_type}}|{{c|std::sub_match<>}}}} |
− | {{ | + | {{|{{tt|const_reference}}|{{c|const value_type&}}}} |
− | {{ | + | {{|{{tt|reference}}|{{|}}}} |
− | {{ | + | {{|{{tt|const_iterator}}|''implementationdefined'' (depends on the underlying container)}} |
− | {{ | + | {{|{{tt|iterator}}|{{|const_iterator}}}} |
− | {{ | + | {{|{{tt|difference_type}}|{{c|std::iterator_traits<>::difference_type}}}} |
− | {{ | + | {{|{{tt|size_type}}|{{c|std::allocator_traits<>::size_type}}}} |
− | {{ | + | {{|{{tt|char_type}}|{{c|std::iterator_traits<>::value_type}}}} |
− | {{ | + | {{|{{tt|string_type}}|{{c|std::basic_string<char_type>}}}} |
− | {{ | + | {{end}} |
===Member functions=== | ===Member functions=== | ||
− | {{ | + | {{begin}} |
− | {{ | + | {{|cpp/regex/match_results/constructor}} |
− | {{ | + | {{|cpp/regex/match_results/destructor}} |
− | {{ | + | {{|cpp/regex/match_results/operator{{=}}}} |
− | {{ | + | {{|cpp/regex/match_results/get_allocator}} |
− | {{ | + | {{h2|State}} |
− | {{ | + | {{mem fun|cpp/regex/match_results/ready|}} |
− | {{ | + | {{h2|Size}} |
− | {{ | + | {{|cpp/regex/match_results/empty}} |
− | {{ | + | {{|cpp/regex/match_results/size}} |
− | {{ | + | {{|cpp/regex/match_results/max_size}} |
− | {{ | + | {{h2|Element access}} |
− | {{ | + | {{|cpp/regex/match_results/length}} |
− | {{ | + | {{|cpp/regex/match_results/position}} |
− | {{ | + | {{|cpp/regex/match_results/str}} |
− | {{ | + | {{|cpp/regex/match_results/operator_at}} |
− | {{ | + | {{|cpp/regex/match_results/prefix}} |
− | {{ | + | {{|cpp/regex/match_results/suffix}} |
− | {{ | + | {{h2|Iterators}} |
− | {{ | + | {{|cpp/regex/match_results/begin}} |
− | {{ | + | {{|cpp/regex/match_results/end}} |
− | {{ | + | {{h2|Format}} |
− | {{ | + | {{|cpp/regex/match_results/format}} |
− | {{ | + | {{h2|Modifiers}} |
− | {{ | + | {{|cpp/regex/match_results/swap}} |
− | + | {{end}} | |
− | {{ | + | |
===Non-member functions=== | ===Non-member functions=== | ||
− | {{ | + | {{begin}} |
− | {{ | + | {{|cpp/regex/match_results/operator_cmp}} |
− | {{ | + | {{|cpp/regex/match_results/swap2}} |
− | {{ | + | {{}} |
+ | |||
+ | {{}} |