Difference between revisions of "cpp/regex/match results"
m (Text replace - "{{tdcl list end" to "{{dcl list end") |
m (Text replace - "{{tdcl" to "{{dcl") |
||
Line 17: | Line 17: | ||
{{dcl list begin}} | {{dcl list begin}} | ||
− | {{ | + | {{list header | regex}} |
− | {{ | + | {{list hitem | Type | Definition}} |
− | {{ | + | {{list item | {{tt|cmatch}} | {{c|match_results<const char*>}}}} |
− | {{ | + | {{list item | {{tt|wcmatch}} | {{c|match_results<const wchar_t*>}}}} |
− | {{ | + | {{list item | {{tt|smatch}} | {{c|match_results<std::string::const_iterator>}}}} |
− | {{ | + | {{list item | {{tt|wsmatch}} | {{c|match_results<std::wstring::const_iterator>}}}} |
{{dcl list end}} | {{dcl list end}} | ||
===Member types=== | ===Member types=== | ||
{{dcl list begin}} | {{dcl list begin}} | ||
− | {{ | + | {{list hitem | Member type | Definition}} |
− | {{ | + | {{list item | {{tt|allocator_type}} | {{c|Allocator}}}} |
− | {{ | + | {{list item | {{tt|value_type}} | {{c|std::sub_match<BidirectionalIterator>}}}} |
− | {{ | + | {{list item | {{tt|const_reference}} | {{c|const value_type&}}}} |
− | {{ | + | {{list item | {{tt|reference}} | {{c|const_reference}}}} |
− | {{ | + | {{list item | {{tt|const_iterator}} | ''implementation defined'' (depends on the underlying container)}} |
− | {{ | + | {{list item | {{tt|iterator}} | {{c|const_iterator}}}} |
− | {{ | + | {{list item | {{tt|difference_type}} | {{c|std::iterator_traits<BidirectionalIterator>::difference_type}}}} |
− | {{ | + | {{list item | {{tt|size_type}} | {{c|std::allocator_traits<Allocator>::size_type}}}} |
− | {{ | + | {{list item | {{tt|char_type}} | {{c|std::iterator_traits<BidirectionalIterator>::value_type}}}} |
− | {{ | + | {{list item | {{tt|string_type}} | {{c|std::basic_string<char_type>}}}} |
{{dcl list end}} | {{dcl list end}} | ||
Revision as of 02:40, 12 June 2012
Template:cpp/regex/match results/sidebar
Defined in header <regex>
|
||
template< class BidirectionalIterator, |
(since C++11) | |
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. It can only be default created or modified by passing to the std::regex_search() or std::regex_match() algorithms.
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 sub_matches 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:
Defined in header
<regex> | |
Type | Definition |
cmatch
|
match_results<const char*> |
wcmatch
|
match_results<const wchar_t*> |
smatch
|
match_results<std::string::const_iterator> |
wsmatch
|
match_results<std::wstring::const_iterator> |
Contents |
Member types
Member type | Definition |
allocator_type
|
Allocator |
value_type
|
std::sub_match<BidirectionalIterator> |
const_reference
|
const value_type& |
reference
|
const_reference |
const_iterator
|
implementation defined (depends on the underlying container) |
iterator
|
const_iterator |
difference_type
|
std::iterator_traits<BidirectionalIterator>::difference_type |
size_type
|
std::allocator_traits<Allocator>::size_type |
char_type
|
std::iterator_traits<BidirectionalIterator>::value_type |
string_type
|
std::basic_string<char_type> |
Member functions
Non-member functions
lexicographically compares the values in the two match result (function template) | |
specializes the Template:cpp/ltf algorithm (function template) |